Michael O’Neill’s side were impressive throughout the European Qualifier at the Groupama Arena and had chances to take the lead in the first half, with Corry Evans missing a golden opportunity after he smashed an effort over the bar from just ten yards out.
However, with 15 minutes remaining, former Watford and Ipswich forward Tamas Priskin leapt above his marker and headed Balazs Dzsudzsak’s corner beyond a sprawling Roy Carroll to give Hungary a 1-0 lead in their Group F clash.
Six minutes later, Norwich City’s Kyle Lafferty danced into the Hungarian area and squared it to Niall McGinn who tapped into an empty net to equalise.
With a draw seemingly inevitable, Northern Ireland broke on the counter and this time McGinn returned the favour by delivering a devilish ball into the area towards Lafferty, who scrambled home from close-range to secure their first away victory since beating Slovenia in September 2010.
O’Neill sprang a tactical surprise by ditching his favoured 3-5-2 for something that threatened to be 4-3-3 but quickly reverted to a more defensive 4-5-1.
There were chances at either end inside five minutes, but the finishing on each occasion suggested a goal-fest was never likely.
Lafferty created the first opportunity, battling to win Chris Baird’s cross and turning the ball deftly for the onrushing Jamie Ward and the Derby man had time to line up his shot but did not appear to realise it, snatching at the effort and sending it tamely towards Peter Gulacsi.
There was more craft in Dzsudzsak’s attempt at the other end, opening his body to spray a first-time shot towards the far post, but it squirmed wide.
Hungary took their time to settle in their new surroundings but gradually began to dictate terms, Dzsudzsak key to everything good and Adam Gyurcso giving Brunt a headache on the right wing.
For the visitors, Ward’s terrier-like willingness to scrap for the ball looked the likeliest route.
He pick-pocketed Zoltan Liptak inside the area only to be challenged before getting his shot away and then made what should have been his crucial intervention. He charged down an apparent lost cause on the halfway but got a kind deflection that put him in behind the home defence before sprinting for goal.
When his shot was pushed out towards the middle of the box, Corry Evans should have buried it. Instead it came a little quicker than expected and sailed high over the crossbar off the midfielder’s instep.
There was a solitary change at the break as Priskin came on up front for Hungary, soon to be joined by Gergo Lovrencsics.
It was the latter who drew the first meaningful save of the game from Roy Carroll and that came with 62 minutes on the clock, Lovrencsics letting fly from the edge of the box and Carroll diving to his left to touch round the post.
O’Neill went to bench by necessity, Ward and Gareth McAuley both taking knocks before being replaced by McGinn and Craig Cathcart.
McAuley’s presence was surely missed as Hungary took the lead from a 74th-minute corner, Priskin getting the critical touch in a packed six-yard box.
Dzsudzsak whipped in a wonderful set-piece but McAuley has made a career of making that area his own. They might easily have buckled but instead they mustered a grandstand finale.
Huge credit goes to Lafferty for the leveller, coming deep for the ball before navigating a roundabout way past the Hungary backline.
When he opened his legs he quickly found a route into the penalty box, skipping one final challenge before measuring a pass across goal for McGinn to tap home unmarked.
A point would have been a decent return on their day’s work but McGinn had other ideas, collecting Evans’ clever pass and looking for Lafferty at the back post.
The finish was hardly elegant but for Northern Ireland, it could not have been sweeter.
Their next Group F clash is against the Faroe Islands at Windsor Park in Belfast on October 11, with the trip to Athens to take on Greece following three days later.