James McClean was the hero as the Republic of Ireland secured a tense 1-0 victory over Wales in a shoot-out for a World Cup play-off spot at the Cardiff City Stadium.
Wales dominated possession but, in the absence of injured star forward Gareth Bale, lacked conviction in the final third and saw their 10-match unbeaten run in competitive home fixtures brought to an end by McClean.
Although top spot in Group in D was not out of reach for either side before kick-off, Serbia's 1-0 victory over Georgia gained them automatic qualification to Russia 2018 and forced Martin O'Neill's side into the play-offs.
Chris Coleman's men appeared to be in control from kick-off but struggled for creativity after a blow to the head resulted in Joe Allen being substituted before half-time.
It was a lapse in concentration that ultimately cost Wales. Wayne Hennessey rolled the ball out to Ashley Williams and the industrious Jeff Hendrick stole possession to set up McClean to lash home a winner for the third time in the campaign.
After a sensational run to the semi-finals of Euro 2016, elimination will come as a bitter blow for Wales, whose wait to reach a World Cup finals for the first time since 1958 continues.
The hosts looked to pile on early pressure and Hal Robson-Kanu – replacing Sam Vokes in Coleman's only change from the 1-0 victory over Georgia – headed a delivery from Joe Ledley narrowly off target from the near post in the third minute.
Wales controlled the ball and Ireland only got a chance to get the ball forward when Allen was booked for a swipe at Meyler's legs. Robbie Brady's free-kick was kept alive by McClean, whose dangerous low cross from the left was turned behind by Ashley Williams.
Hendrick was unable to add a finishing touch following a scramble in the Wales box, while Tom Lawrence's attempt to repeat his goalscoring heroics in Tbilisi saw his effort deflected into the arms of Ireland goalkeeper Darren Randolph.
Allen was replaced by Jonny Williams in the 37th minute after taking a blow to the head from Meyler as he leapt to challenge for a high ball and Wales struggled to create anything further before the break, Ireland looking comfortable as they sat back.
The hosts again came out positively and eight minutes after the restart Robson-Kanu saw a powerful header from Jonny Williams' right-wing cross brilliantly palmed over by Randolph.
Ireland punished Wales' shortcomings in the final third when Hennessey's distribution put Ashley Williams under pressure and he was dispossessed by Hendrick. He raced away from the Everton defender and pulled a quality cross back to McClean, who rifled an unerring finish into the bottom-right corner.
Coleman introduced Ben Woodburn – who netted the winner on debut against Austria – and Vokes in an attempt to galvanise his side and they nearly combined for an equaliser with nine minutes remaining, but the Burnley striker was unable to connect with a sweet inswinging cross from his fellow substitute.
O'Neill's men remained resolute and showed the same defensive solidity they did before the break to see out a famous victory and break Welsh hearts, but their own journey is not over yet and they will be without captain Meyler for the first leg of the play-offs after his stoppage-time booking.