After a goalless first half, Michael O'Neill's men were superb during an enthralling second period and they will now face Germany in Paris on Tuesday knowing that a draw could potentially be enough to earn a place in the last 16.
Northern Ireland were on the back foot but towards the end of the first half, they created numerous chances to take the lead with Craig Cathcart heading a yard wide of the post and Pyatov pulling off a tremendous save to deny Steven Davis from an acute angle.
Both teams returned for the second half intent on pushing for a goal, and it took just four minutes for Northern Ireland to break the deadlock after an inswinging delivery from Oliver Norwood was met by McAuley, who powerfully headed the ball across goal and into the far corner.
There were jubilant scenes inside the Green Army section of the stadium but their joy was nearly short-lived when Yevhen Seleznyov headed straight at McGovern from 10 yards.
Northern Ireland remained undeterred and pushed for a second goal, with Norwood forcing a save out of Pyatov and Conor Washington heading wide from 12 yards, before there was a brief delay in play due to a hail storm.
The break suited Ukraine and although chances were few and far between heading into the final quarter of the game, Viktor Kovalenko sent two shots wide from the edge of the area.
Northern Ireland were spent as an attacking force and O'Neill was reliant on his defence trying to hold out for three precious points but they soon found themselves trying to survive on the edge of their own penalty area.
A driven effort from Andriy Yarmolenko was pushed away by McGovern as the game entered six minutes of added-on time but after surviving everything thrown at them by Ukraine, Northern Ireland broke up the other end of the pitch to seal a famous triumph.
© Getty Images
Josh Magennis did superbly on the right byline before cutting the ball back to Norwood, whose shot was saved by Pyatov, but the rebound fell to McGinn to lash home into an empty net to spark pandemonium in the stands as Northern Ireland registered their first ever success at the European Championship.