Ireland claimed their first Grand Slam in 61 years in a sensational climax to this year's Six Nations Championship.
The Irish overturned a 6-0 interval deficit with early second-half tries from Brian O'Driscoll and Tommy Bowe.
Stephen Jones kicked his third and fourth penalties and appeared to have won the Triple Crown for Wales with a drop-goal with five minutes remaining.
But Ronan O'Gara's drop-goal regained the lead with two minutes left, and Jones's last-gasp penalty fell short.
Wales, from being within two minutes of denying Ireland a Grand Slam, but not their first-ever Six Nations title, suddenly had to come to terms with finishing fourth in the championship.
The hosts, needing to win by 13 points to retain their title, planned to target O'Gara from the off, but skipper Ryan Jones set a bad example with a trip on the fly-half in the first minute.
Ireland celebrate historic Grand Slam
Ireland lock Donncha O'Callaghan objected to Jones's actions and a minor tussle between the players earned an early warning from English referee Wayne Barnes, but O'Gara failed with the long-range penalty attempt.
Ireland responded with a Gordon D'Arcy break only for Gavin Henson's tackle to thwart Luke Fitzgerald, and a testing O'Gara cross-kick that Shane Williams and Lee Byrne failed to deal with.
The immediate pressure on Wales was relieved when Ian Gough's challenge knocked the ball out of Jerry Flannery's hands and Henson sent a huge clearance kick downfield.
But when Wales had their first defensive line-out, the hosts were in danger of cracking as Matthew Rees's throw could not be cleanly gathered and Shane Williams rescued his side, but was forced to concede a five-metre scrum.
Wales held firm in defence, Mark Jones's tackle on Ireland captain O'Driscoll forcing him to knock-on in a passage of play that led referee Barnes to warn both captains about off-the-ball incidents.
O'Gara kicked the ball out on the full twice, perhaps indicating the early attention Wales paid to him was paying dividends.
Lock Paul O'Connell led the way as Ireland stole home line-out ball on successive occasions and as both sides belied the occasion to vary their attacking play, that advantage boosted the visitors' confidence.
The Grand Slam chasers were happy to kick for touch in the belief they could successfully attack Wales' line-out.
But after Lee Byrne departed with an ankle injury, Henson switching to full-back to accommodate Jamie Roberts, Denis Leamy held on too long in a tackle on Martyn Williams at the back of a line-out and Stephen Jones kicked the 33rd-minute penalty.
Another throw to Williams at the back spelled danger for Wales as the veteran flanker was unable to gather, but Fitzgerald blocked the defence from tackling O'Gara and Jones struck from 49 metres to give Wales a 6-0 lead going into the break.
Ireland began the second half with a Bowe burst down the right from O'Driscoll's pass and an O'Gara cross-kick that Mark Jones made safe, but failed to mark before he stepped into touch.
Ireland celebrate in Cardiff as they win a historic Grand Slam
That gave Ireland the platform and territory their forwards craved and after a series of close-quarter drives, O'Driscoll's good leg strength and body angle was enough for him to claim the score.
French television match official Romain Poite had to make that decision in the 44th minute, but two minutes later Bowe claimed O'Gara's chip and raced away from the pursuing Shane Williams to score under the posts.
O'Gara converted both tries for a 14-6 lead, but Wales were soon back in the hunt.
O'Callaghan's petulant push on Mike Phillips after the scrum-half had knocked on gave fly-half Jones the chance to hit the mark, which he did via an upright.
A timely O'Driscoll tackle on Tom Shanklin helped thwart a Wales attack and Bowe was denied by a knock-on as he won an aerial joust with Ospreys team-mate Williams.
The other aerial battle, at the line-outs, was also going in Ireland's direction. But Irish composure again failed them to allow Jones to kick a fourth penalty.
Wales coach Warren Gatland attempted to solve his side's line-out issues by sending Luke Charteris on for Gough and Huw Bennett for hooker Matthew Rees ahead of the final quarter.
A rare long-range Gavin Henson penalty attempt fell short after 68 minutes and Ireland brought on Peter Stringer at scrum-half for O'Leary for the final 10 minutes.
And that is when the drama truly unfolded. For the first time in the game, Wales' strike runners began to make their mark.
Wing Williams slipped to end one attack, but after Phillips's thunderous charge through the Welsh defence, Jones dropped the goal that put his side back into the lead.
O'Gara replied moments later after his opposite number kicked out on the full to give Ireland the attacking platform.
Jones had one last chance to redeem the season for Wales, but his effort from just inside the Ireland half fell short and Ireland were at last able to taste Grand Slam champagne.
Wales: Byrne; M Jones, Shanklin, Henson, S Williams; S Jones, Phillips; Jenkins, Rees, A. Jones, Gough, A Jones, D Jones, M Williams, R Jones (capt). Replacements: Roberts for Byrne (30), Bennett for Rees (55), Charteris for Gough (55). Not Used: Yapp, J Thomas, Fury, Hook.
Ireland: Kearney; Bowe, B O'Driscoll, D'Arcy, Fitzgerald; O'Gara, O'Leary; Horan, Flannery, Hayes, O'Callaghan, O'Connell, Ferris, D Wallace, Heaslip. Replacements: Murphy for Kearney (66), P Wallace for Fitzgerald (76), Stringer for O'Leary (69), Best for Flannery (68), Leamy for Ferris (blood, 7), Court for Hayes (blood, 27) Not Used: M O'Driscoll.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.