Ireland inflicted a fourth successive RBS Six Nations defeat on Scotland after prevailing 32-14 at the Aviva Stadium on Saturday evening.
The hosts crossed four times in total and overcame the absence of key duo Brian O'Driscoll and Paul O'Connell to claim a hard-fought win.
Stand-in captain Rory Best started the ball rolling with a well-worked try before Eoin Reddan and Andrew Trimble struck in between a fine solo effort from Scotland back-rower Richie White.
Replacement Fergus McFadden added extra authority to the scoreline late on after Max Evans had been sin-binned for a cynical trip, and Scotland must now turn their attention to a wooden spoon decider against Italy next weekend.
Scotland were dealt a blow just before kick-off when Nick De Luca was ruled out with a hamstring injury. His absence paved the way for Evans to return at outside centre.
Visiting fly-half Greig Laidlaw took advantage of early indiscipline from Ireland, firing over two penalties inside the opening 10 minutes to put Scotland 6-0 in front.
But the response from the hosts was clinical, hooker Best crashing over following a well-worked line-out routine. Jonathan Sexton expertly added the extras from the touchline.
The Leinster No.10 was on target again just before the half hour, his penalty putting Ireland 10-6 ahead after Allan Jacobsen had been punished in the scrum.
Scotland deservedly cut the deficit when Laidlaw made it three from three on 32 minutes, but the Scots were the architects of their own downfall just 90 seconds later when Reddan squirmed past a host of would-be tacklers to score. Sexton converted.
Scotland were rewarded for their attacking persistence three minutes before the interval when Gray scored his first try in 20 Tests, brushing past Reddan and Tommy Bowe before fooling Rob Keaney with a dummy.
But there was to be yet more drama before the break when winger Trimble stepped inside Lee Jones to score in the corner. Sexton failed to add the extras, meaning Ireland went into the break 22-14 ahead.
Graeme Morrison brilliantly denied Bowe what would surely have been a killer score in the early stages of the second half, with the Scotland centre holding up the Ospreys man on the try-line.
And so after a flurry of points in the first half, chances suddenly became few and far between in the second as Ireland comfortably preserved their lead.
They had to wait until the 72nd minute before extending it, Sexton taking his tally for the evening to 10 points with a penalty which put Ireland 11 clear.
Evans' trip denied Keith Earls what would have been a fine individual try just a minute later and the resulting yellow card meant Scotland were forced to play the remaining exchanges with 14 men.
The numerical advantage proved pivotal and, after a forceful scrum, substitute McFadden was able to dive over from close range for his third Test try. Sexton capped an impressive performance with the extras.