Wales claimed a controversial victory at the Millennium Stadium which kept their RBS 6 Nations title hopes alive and ended Ireland's bid for a fifth Triple Crown in eight seasons.
Scrum-half Mike Phillips celebrated his 50th cap by scoring an opportunist try to underpin Wales' first home win since last year's tournament.
But it came after Wales skipper Matthew Rees took a quick throw-in with a different ball from the one that was sliced into touch by Irish substitute Jonathan Sexton, which is against rugby's Law 19.2.
Referee Jonathan Kaplan consulted Scottish assistant official Peter Allan before awarding the score, but the Irish players were furious as television replays confirmed the try should never have been allowed.
Wales rode their luck as fly-half James Hook converted the try and kicked three penalties, while wing Leigh Halfpenny landed a long-range strike, with Ireland creating a Brian O'Driscoll try and Ronan O'Gara booting eight points which took him past 1,000 in Test rugby.
Captain O'Driscoll's 24th international championship touchdown equalled the career record of Scotsman Ian Smith that has stood for 78 years, but there will be no Triple Crown assault against title-chasing England in Dublin next Saturday.
It was only Ireland's second defeat in the Welsh capital since 1983 as the home side celebrated coach Warren Gatland setting a new Wales record of 36 Tests at the helm.
Most of it was not pretty from a Welsh perspective, but they at least have an outside chance of silverware going into the final weekend, albeit with a vastly inferior points difference to England's.
A third successive Six Nations victory after away-day triumphs in Edinburgh and Rome represents a reasonable campaign whatever happens away to France next Saturday night.
Ireland though, must reflect on a below-par season and a glittering chance they blew during the game's final passage of play when substitute Paddy Wallace ignored an unmarked Keith Earls outside him.
Wallace cut back inside and prop Cian Healy then dropped the ball, allowing Hook to kick it out of play and leave Ireland crestfallen.
Ireland suffered a crushing injury blow after just 40 seconds when their former Wasps scrum-half Eoin Reddan was hurt in almost freakish circumstances.
Attempting to charge down a Lee Byrne clearance kick, the ball hit him full in the face and he was helped off after treatment to be replaced by Peter Stringer.
Ireland were not ruffled though and scored less than two minutes later from a simple move which saw wing Tommy Bowe take an outside angle the Wales defence could not close down, allowing O'Driscoll his record-equalling try.
O'Gara continued the landmark theme by adding a conversion to bring up his 1,000 points, joining the four other members of that exclusive club - Jonny Wilkinson, Dan Carter, Neil Jenkins and Diego Dominguez.
Wales did not escape during a punishing opening quarter, losing prop Craig Mitchell with a dislocated shoulder that meant an early introduction for Cardiff Blues forward John Yapp.
Mitchell's likely long-term absence could mean a recall for his Ospreys colleague Adam Jones, who has recently returned to Magners League action after an elbow injury, against France.
The home side enjoyed the lion's share of possession and territory, but had only a Hook penalty to show for their efforts after his opening strike hit the post.
Hook then cut the gap with another penalty, only for O'Gara to reply and give Ireland a 10-6 advantage.
There were plenty of errors from both sides, but Kaplan's willingness to allow a contest at the breakdown helped maintain a high tempo as Halfpenny landed a long-range penalty which kept Wales within striking distance.
But Ireland applied the final scoring touch before the break through an O'Gara penalty after Phillips was punished for not releasing possession in a tackle.
Ireland coach Declan Kidney surprisingly sent on Sexton for O'Gara after 50 minutes, but it had entirely the opposite effect as Wales capitalised on a blunder by the Leinster number 10.
Sexton sliced a kick straight into touch, Rees took a quick throw and Phillips sprinted over from 40 metres, with the try being allowed despite Ireland's complaints.
Ireland lock Paul O'Connell, the 2009 British and Irish Lions skipper, was particularly animated, seeming to urge Kaplan that he should consult video referee Geoff Warren, but the protests fell on deaf ears.
Hook added the extras before Sexton's horror show continued when he missed an easy penalty chance that would have drawn Ireland level.
And Hook then sealed the deal when he completed his hat-trick, giving Wales a much-needed home win and leaving Ireland to ruefully reflect on a defeat that will hurt them deeply.Reuse content