Robbie Brady got the Republic of Ireland out of jail as they secured their Nations League B status with a madcap 3-2 win over nine-man Armenia.
The 30-year-old, making his first start for his country since March last year, converted a stoppage-time penalty to snatch victory after Ireland very nearly threw the game away.
They looked to be cruising to just their second win of the Group 1 campaign as they entered the final 20 minutes leading 2-0 through goals from John Egan and Michael Obafemi.
However, goals from Artak Dashyan and Eduard Spertsyan silenced the locals before Brady’s last-gasp intervention, the build-up to which saw both Hovhannes Hambardzumyan and Dashyan dismissed.
The win – just manager Stephen Kenny’s fourth in 21 competitive fixtures – came as a relief on a night when defeat would have meant relegation, but third place behind Scotland and Ukraine represents a poor return for a nation which set out with ambitions to win the group.
Intent on revenge for their 1-0 defeat in Yerevan, Ireland went straight on to the front foot as Jayson Molumby conducted proceedings from central midfield to force the visitors’ five-man defence back to within touching distance of keeper David Yurchenko.
Such was the home side’s early dominance that central defenders Nathan Collins and Dara O’Shea repeatedly found themselves in advanced positions, but they did not create an opening of note until Jason Knight picked out Obafemi with an 11th-minute cross and saw the striker head wastefully wide.
Egan headed wide after O’Shea had turned Brady’s 15th-minute corner back across goal, but the Sheffield United defender was not found wanting when presented with a second opportunity three minutes later.
He timed his jump perfectly to meet Brady’s inswinging corner and power a downward header towards goal, where Yurchenko was unable to keep the ball out of his net as it reared up off the turf.
Knight and Brady both had shots blocked as the green shirts poured forward, but a lack of precision and a failure to move the ball as quickly as they had earlier allowed the Armenians, who had not mustered a single attempt on goal, to reach the break without further damage.
Molumby’s evening might have taken a decided turn for the worse within three minutes of the restart when, having collected a first-half booking for a foul on Lucas Zelarayan, he appeared to pull back Artak Grigoryan, although Slovenian referee Rade Obrenovic took a benevolent view and the midfielder was withdrawn soon afterwards.
He had barely settled in his seat when Ireland extended their lead, Obafemi turning smartly 30 yards out before closing on goal and driving a skidding long-range effort beyond Yurchenko’s despairing dive.
Collins headed Brady’s inviting near-post corner over on the hour and Jeff Hendrick went wide from distance with the game seemingly won, but it was then that they were hit with two sucker punches.
Keeper Gavin Bazunu, who had been little more than an interested by-stander until that point, had to turn Styopa Mkrtchyan’s 71st-minute shot against a post, but when the ball fell to fellow substitute Dashyan, there was nothing he could do to keep it out.
Disappointment turned to horror within two minutes when Spertsyan, whose goal proved decisive at the Republican Stadium, repeated the dose to level at 2-2.
Khoren Bayramyan whistled an 83rd-minute attempt just wide of Bazunu’s far post as Armenia threatened to snatch victory, but it was the home side who eventually prevailed in dramatic circumstances after Dashyan was adjudged to have handled O’Shea’s shot inside the area after a VAR review.
Brady had to wait as Mr Obrenovic dismissed both Hambardzumyan and the unfortunate Dashyan amid furious protests, but calmly sent Yurchenko the wrong way to spare Ireland’s blushes.