Carey sent Ukraine keeper Artem Kychak the wrong way from the spot after Terry Dixon had been taken down in the final minute of the match.
Ukraine ran the first half and finally took the lead on 35 minutes through Oleksandr Volkov.
However Tom Lyons punished a defensive mistake to equalise within a minute, and help set up victory for the visitors.
The Republic of Ireland will face Italy on Thursday 29th September, Banninkov Stadium, Ukraine. Kick off 15.30 hrs (local time)
Republic of Ireland: Shane Redmond (Nottingham Forest),
Andrew Callaghan (Millwall), Lorcan Fitzgerald (c) (West Ham United), Garry Breen (Manchester City), Gavin Donoghue (Sunderland), Michael Daly (Cherry Orchard), Paul Cahillane (Celtic), Graham Carey (Celtic), Donal McDermott (Manchester City), Tom Lyons (Crystal Palace), Karl Byrne (Belvedere)
Subs: Terry Dixon (Tottenham Hotspur) on for Karl Byrne, 40 Mins, Paul Skinner (Celtic) on for Shane Redmond, 50 Mins, Cillian Sheridan (Belvedere) on for Tom Lyons, 70 Mins