Ireland survived a second-half horror show to eventually secure a 3-2 victory over Armenia in their final UEFA Nations League clash at the Aviva Stadium.
John Egan opened the scoring for Stephen Kenny's side in the 18th minute, before Michael Obafemi doubled the lead just after half-time.
However, from a position of comfort, Ireland let the opponents back into the contest, conceding twice in two minutes as Artak Dashyan and Eduard Spertsyan restored parity.
But the blushes would eventually be spared in the final moments of the game as Ireland were awarded a penalty, which Robbie Brady converted to hand Kenny's side their second win of the campaign.
There was no sign of nerves in the opening exchanges as Ireland set about putting the relegation issue to bed early in the contest, piling forward in the opening five minutes looking for that early breakthrough.
A 3-5-2 formation of sorts to start the game, however, both wing-backs and even centre-half Nathan Collins were loitering with intent in the final third throughout.
GOAL Rep of Ireland 1-0 Armenia— RTÉ Soccer (@RTEsoccer) September 27, 2022
18’ Ireland make the breakthrough as John Egan makes it two goals in as many games with a powerful header
📱 Updates https://t.co/vWFplRobwr
#IRLARM #COYBIG #NationsLeague pic.twitter.com/Pl19acOiH7
The first real chance arrived in the 11th minute as a Jason Knight ball from the left was sent curling towards the back post. A backpeddling Michael Obafemi eventually made contact, but his glancing header could not be directed on target.
Dara O'Shea was next to get a look at goal, connecting well with a deep Robbie Brady corner in the 14th minute, and while he powered the ball back across the face, Egan was unable to guide the ball home, just yards from goal.
Then in the 17th minute Jason Knight’s connection from a Matt Doherty cross was deflected wide, but the breakthrough appeared to be coming, and it would arrive from the subsequent set-piece.
Brady’s corner from the right was started towards the penalty spot, always working its way back towards the goal, and Egan cleverly checked his run, stepping back from the crowded six-yard box to evade his marker and guide a powerful downward header into the back of the net, giving David Yurchenko no chance.
Armenia were yet to threaten inside the Ireland half, and while they looked for a response, the best they could manage was a lofted free into the box, which proved straightforward for Gavin Bazunu, collecting with confidence.
A sustained period of Irish possession followed, and while the majority of play was within the Armenia half, there was little invention, with Hendrick unable to get on the ball – the ball continually played out wide to Brady to begin again.
A snap-shot from the Preston man did follow in the 35th minute from a dropping ball just inside the box, but his placed right foot volley was blocked en route to goal.
Collins finally stepped up to play a fine through-ball in the 38th minute to Hendrick, who raced in on the right, however, his cross was intercepted for a corner.
In the 40th minute, Armenia finally moved the ball up the pitch and while they secured a corner, it was easily dealt with and that was as good as it got for the visitors in the first half, as Ireland took the lead into the break.
Ireland nearly doubled the lead after four minutes of the second half as Robbie Brady's cross from the left was deflected goalwards by the boot of Varazdat Haroyan, and it took a quick reaction save by Yurchenko to get down to his right and prevent the ball sneaking inside the near post.
It was the first save that the keeper made throughout the entire game, but he could do nothing to keep out another moment of Obafemi magic that followed in the 52nd minute.
GOAL Rep of Ireland 2-0 Armenia— RTÉ Soccer (@RTEsoccer) September 27, 2022
52' Michael Obafemi with a brilliant strike from distance to give Ireland a two-goal cushion
#IRLARM #COYBIG #NationsLeague
📱 Updates https://t.co/vWFplRobwr pic.twitter.com/HBsAAekTbP
The ball was played into the feet of the centre-forward and his first touch allowed him to turn goalwards, his sights set firmly on the target, before the Swansea striker unleashed another unstoppable effort at the Lansdowne Road arena, this time, his low shot rifling across the keeper and into the bottom left corner.
Conor Hourihane had come on for Jayson Molumby early in the half as the midfielder was skating on thin ice, already on a yellow card, and in the 67th minute a trademark whipped cross from the left almost found Doherty arriving at the back post – the keeper doing enough to avert the danger.
Three changes from Armenia in an attempt to ease the persistent pressure, and it proved inspired by coach Joaquín Caparrós, as they got right back in the game.
In the 71st minute, Vahan Bichakhchyan raced in from the right and his curling effort from distance was helped onto the post by Bazunu, however, Artak Dashyan was quickest to react and smashed the ball home from just inside the box.
If the goal was a wake-up call, what followed would set alarm bells ringing around the stadium as Eduard Spertsyan latched onto a very casual Hourihane pass just outside the box, before curling a right-footed shot beyond Bazunu and into the back of the net.
A panicked Ireland looked for a response and while it came courtesy of another set-piece in the 76th minute, Collins' header was well saved before Hourihane blasted over from ten yards out.
But Armenia sensed a chance to capitalise on the clearly shaken hosts and with thoughts of an unlikely great escape growing more realistic, they pushed forward and almost went ahead as Khoren Bayramyan’s low effort flew just wide.
Ireland were running out of time but they were handed a lifeline, literally, as VAR intervened to award a penalty following a goalmouth scramble when Dara O’Shea’s snap-shot was blocked en route to goal by a stumbling Dashyan, with his hand out of its natural position.
Rep of Ireland 3-2 Armenia— RTÉ Soccer (@RTEsoccer) September 27, 2022
89' Drama at the death as VAR awards penalty to Ireland while incensed Armenia are reduced to nine men.
#IRLARM #COYBIG #NationsLeague
📱 Updates https://t.co/vWFplRobwr pic.twitter.com/ij0veJvzWg
Fuming Armenia protests would lead to the dismissal of Hovhannes Hambartsumyan and the perpetrator, Dashyan, as Brady waited an age to take the spot-kick on the stroke of full-time.
Eventually, the Dubliner would step up and send the keeper the wrong way as he rolled the ball into the bottom left corner to send the still-shocked crowd delirious as the win was secured.
Five minutes of injury time were seen out against the nine men, with substitute Scott Hogan missing a good chance to make it four, as Ireland ended their campaign with a far-from-convincing, yet much needed victory.
Republic of Ireland: Gavin Bazunu; John Egan (capt), Nathan Collins, Dara O'Shea; Matt Doherty, Robbie Brady, Jayson Molumby (Conor Hourihane 51), Jeff Hendrick, Jason Knight (Alan Browne 76); Michael Obafemi (Scott Hogan 86), Troy Parrott (Callum Robinson 76)
Armenia: David Yurchenko; Andre Calisir (Karen Muradyan 82), Hovhannes Hambartsumyan, Varazdat Haroyan (capt), Hrayr Mkoyan (Taron Voskanyan 60); Artak Grigoryan, Eduard Spertsyan, Khoren Bayramyan, Jordy Monroy (Artak Dashyan 60); Lucas Zelarayán (Vahan Bichakhchyan 69), Tigran Barseghyan (Zhirayr Shaghoyan 82)
Referee: Rade Obrenovič (SVN)