Wales spoil O'Connell's Dublin farewell
The Welsh also spoilt Paul O'Connell's Dublin send-off with a dramatic 16-10 World Cup warm-up victory.
Having been swept aside 35-21 by Ireland in Cardiff just three weeks ago, Justin Tipuric's try and the boot of Leigh Halfpenny saw Wales defeat the Six Nations champions on home soil.
However, the victory came down to a last-gasp decision by video official Graham Hughes, who ruled Ireland hooker Sean Cronin was held up between the posts.
Aaron Jarvis and Leigh Halfpenny, who kicked 11 points, combined to deny Cronin in injury time to secure the win.
A first home defeat in 10 games, a run stretching back to November 2013, was hardly the send-off Ireland had hoped to give captain O'Connell in his last home Test before he retires from international duty after the World Cup in England, which starts next month.
Ireland were also left with a major injury concern regarding wing Keith Earls, taken off on a stretcher in the second half with a neck injury.
Wales, though, will be delighted to claim the scalp of a team second in the world rankings, especially as they have been drawn in a tough World Cup pool that includes the hosts and Australia.
Warren Gatland, the Wales coach, will have been pleased with the start made by new prop Tomas Francis, who began his Test debut with a series of strong displays in the scrums.
Just as when these sides met at the Millennium Stadium earlier this month, it was the away team that seized the initiative as Wales powered into a 10-0 lead after 26 minutes.
On the back of a solid set-piece, Wales mounted a series of attacks and Ireland's usual discipline abandoned them.
Halfpenny opened the scoring with an 18th-minute penalty before Tipuric scored for the second game in a row against Ireland.
Lock forward O'Connell was warned by referee Craig Joubert for his team's mounting penalty count and Ken Owens twice went close as Wales maintained the pressure.
Their persistence paid off at a third line-out drive that saw backs join forwards and back-row Tipuric got the crucial touch in the 25th minute for the game's first try, converted by Halfpenny.
Johnny Sexton clawed back three points just moments later but it was not until the stroke of half-time that Ireland levelled the scores.
Wales appeared to have cleared the danger when the outstanding Tipuric claimed another turnover. But his back row colleague Taulupe Faletau lost possession to allow Ireland another chance as the half ticked into additional time.
Peter O'Mahony made the initial burst and lock Iain Henderson was on-hand, crashing through Dan Biggar and Scott Williams before stretching out to score despite the challenge of Owens. Sexton converted to tie the scores.
The second half was a far tighter affair that was marred by injuries for both teams.
Jamie Roberts suffered a heavy knock in a mid-air collision with Rob Kearney and was forced off 10 minutes later.
Sean O'Brien was then ruled to have been held up over the try-line by Hughes.
There was more bad news for Ireland when Earls was carried off with his neck in a brace on 64 minutes.
Halfpenny scored with a second penalty when play resumed and added a third but only after Wales survived an injury scare of their own when Alun Wyn Jones twisted his knee.
Jones recovered and Wales held out for a telling result.
Ireland conclude their warm-up programme away to England at Twickenham a week on Saturday, when Wales face Italy at Cardiff's Millennium Stadium.
Man of the Match: Johnny Sexton showed why he is regarded as one of the best flyhalves in the world with a commanding performance. His opposite number Dan Biggar had an impressive first half but faded during the second half. Justin Timuric had a collosal game. His work-rate and ability to contest for the ball on the ground was instrumental in Wales' victory.
Moment of the Match: Undoubtably the fantastic steal that Justin Timuric made centimeters from his own goal-line, when Ireland almost took the lead after the score was 10-10.
Villain of the Match: It was a tough match but the discipline was impeccable.
Scorers:
For Ireland:
Try: Henderson
Con: Sexton
Pen: Sexton
For Wales:
Try: Tipuric
Con: Halfpenny
Pens: Halfpenny 3
Teams:
Ireland: 15 Rob Kearney, 14 Dave Kearney, 13 Luke Fitzgerald, 12 Robbie Henshaw, 11 Keith Earls, 10 Johnny Sexton, 9 Conor Murray, 8 Jamie Heaslip, 7 Jordi Murphy, 6 Peter O'Mahony, 5 Paul O'Connell (captain), 4 Iain Henderson, 3 Nathan White, 2 Richardt Strauss, 1 Jack McGrath.
Replacements: 16 Sean Cronin, 17 Dave Kilcoyne, 18 Tadhg Furlong, 19 Donnacha Ryan, 20 Sean O'Brien, 21 Eoin Reddan, 22 Paddy Jackson 23 Felix Jones.
Wales: 15 Leigh Halfpenny, 14 Alex Cuthbert, 13 Scott Williams, 12 Jamie Roberts, 11 George North, 10 Dan Biggar, 9 Rhys Webb, 8 Taulupe Faletau, 7 Justin Tipuric, 6 Dan Lydiate, 5 Alun Wyn Jones (captain), 4 Bradley Davies, 3 Tomas Francis, 2 Ken Owens, 1 Gethin Jenkins.
Replacements: 16 Scott Baldwin, 17 Paul James, 18 Aaron Jarvis, 19 Luke Charteris, 20 James King, 21 Gareth Davies, 22 Rhys Priestland, 23 Hallam Amos.
Referee: Craig Joubert (South Africa)
Assistant referees: Wayne Barnes (England), Luke Pearce (England)
TMO: Graham Hughes (England)
Agence France-Presse & @rugby365com