Northern Ireland's Euro 2020 qualifying hopes survived a scare as substitutes Conor Washington and Josh Magennis scored twice in four minutes to snatch a 2-1 win in Estonia.
Konstantin Vassiljev's 25th-minute free-kick looked like being the difference between the two sides as Northern Ireland's struggles in front of goal away from home continued, but Michael O'Neill's men turned it around in Tallinn in the final 15 minutes.
Conor Washington struck first, cutting in from the left before firing in – perhaps with the help of a deflection off Magennis, who then got the slightest of touches to turn Jordan Jones' cross beyond the reach of keeper Sergei Lepmets.
Defeat here would have left their Euro 2020 hopes hanging by a thread with home and away games against Holland and Germany to come later in the year, but victory keeps them top of the group with a maximum haul of nine points ahead of Tuesday's trip to Belarus.
It was a dramatic end to a game which threatened to end in frustration, with O'Neill's men showing for too long why they came into the night without an away goal in seven outings.
Though they bossed possession early on, chances were few and far between and once Vassiljev – their tormentor in a World Cup qualifier eight years ago – had punished a mistake by Stuart Dallas with a low, bending free-kick around the wall, Northern Ireland looked panicked as they gave the ball away.
Estonia had the ball in the net again six minutes before the break but it was ruled out by referee Fabio Verissimo, perhaps generously as goalkeeper Bailey Peacock-Farrell appeared to run into Rauno Sappinen before Madis Vihmann headed in.
At the other end Gavin Whyte, making his first competitive start, sent in a fine cross but Liam Boyce could not get the direction on his glancing header and Estonia ended the half on top, with Vassiljev scuffing a shot wide when left virtually unmarked inside the area.
O'Neill sent on Washington for Boyce at half-time to try to find a spark, but Northern Ireland lacked composure and were almost punished as Vassiljev sent a dipping shot on to the crossbar.
Northern Ireland soon began to stir and Dallas cut in from the left and picked out George Saville, who poked the ball goalwards to bring a first save of the night from Lepmets.
Peacock-Farrell had to save low down from Vlasiy Sinyavskiy as Estonia looked to hit their opponents on the counter-attack, but the flow of traffic was now firmly in Northern Ireland's favour.
Lepmets fluffed a clearance to gift the ball to Jones, but scrambled back into position before the Rangers winger floated a cross over.
But Northern Ireland got their equaliser in the 77th minute when Washington cut in from the left side and was able to run straight to the centre of the goal before clipping a shot over Lepmets, with Magennis on hand and possibly getting a touch on the ball.
And three minutes later Northern Ireland were ahead as Magennis got between defenders and deftly turned Jones' cross into the far corner.
The celebrations were almost cut short by Artjom Dmitrijev, but Peacock-Farrell was at full stretch to push his powerful drive away.
There was another late scare as Dimitrijev headed just wide while Jones was close to adding a third at the other end, but Northern Ireland had already done enough.
ga('create', 'UA-72310761-1', 'auto', {'name': 'pacontentapi'});
ga('pacontentapi.set', 'referrer', location.origin);
ga('pacontentapi.set', 'dimension1', 'By Ian Parker, Press Association Sport, Tallinn');
ga('pacontentapi.set', 'dimension2', 'b6898da6-ea76-4639-8cde-368167a69fe7');
ga('pacontentapi.set', 'dimension3', 'paservice:sport,paservice:sport:football,paservice:sport:uk');
ga('pacontentapi.set', 'dimension6', 'story');
ga('pacontentapi.set', 'dimension7', 'composite');
ga('pacontentapi.set', 'dimension8', null);
ga('pacontentapi.set', 'dimension9', 'sport:football');
ga('pacontentapi.send', 'pageview', { 'location': location.href, 'page': (location.pathname + location.search + location.hash), 'title': 'Magennis the hero as Northern Ireland salvage win in Estonia'});