Kyle Lafferty spared the blushes of Northern Ireland goalkeeper Michael McGovern as his injury-time equaliser helped to compensate for his team-mate's earlier error 1-1 draw with Hungary.
Northern Ireland squandered the chance to qualify for Euro 2016 on the night, but the mood at Windsor Park was one of relief after the home side looked destined for defeat before Lafferty's last-ditch goal from close range.
Nobody was more relieved than McGovern, who had allowed Balazs Dzudzsak's second-half free-kick to slip through his hands to gift Richard Guzmics the easiest of tap-ins, before defender Chris Baird was sent off as frustrations boiled over in Belfast.
Baird was booked twice in two minutes to receive his marching orders with seven minutes remaining, but there was more drama to come as Lafferty – who will miss Northern Ireland's next qualifier due to a suspension – buried a last-minute chance.
The result means Northern Ireland stay top of Group F, but they will be without Baird and Lafferty as they look to secure qualification in their next game against Greece.
If the home side needed any extra incentive to secure qualification on the night, they got it when Lafferty's late challenge earned him a booking that means he will be suspended for the visit of Greece.
Hungary were pegged back for large parts of the first half and after the restart, Lafferty was inches away from getting a toe on Gareth McAuley's knockdown at close range, before Zoltan Gera flashed a header just wide of McGovern's goal for Hungary.
With the game opening up, Jonny Evans headed just over the bar, before Michael O'Neill replaced Corry Evans with Niall McGinn, who was Northern Ireland's hero in the corresponding fixture in Budapest, where he scored one goal and provided an assist for another in a 2-1 win.
The home crowd urged their side to attack and they soon responded, with Oliver Norwood drawing a good save from Gabor Kiraly with a long-range drive.
Hungary improved as the second half progressed, with Zsolt Kalmar and Gera both giving McGovern cause for concern with shots that went close.
Kalmar then gave McGovern his first test of the evening with 20 minutes remaining, launching a fierce free-kick that the Hamilton captain had to stretch to keep from dipping under the crossbar.
Moments later, the ball was in the net when McGovern flapped at a Balazs Dzsudzsak free-kick and Guzmics was on hand to tuck the ball into an empty net from close range.
There were three bookings in a heated last 10 minutes, two of which went to Baird, whose cynical hacking of Kalmar shortly after his foul on Dzsudzsak gave the referee little choice but to send him off.
Just as it looked like a miserable night for the home crowd, Lafferty struck right at the death when a Steven Davis corner bounced right through the box to McGinn, whose shot rebounded and Lafferty pounced to salvage a vital point.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.