Scotland produced a stunning display to record a 23-20 victory at Croke Park, with Glasgow Warriors fly-half Dan Parks kicking a 78th-minute penalty to secure the win.
Parks' last-gasp effort came after the 31-year-old had been named man-of-the-match thanks to yet another fine individual display.
Glasgow's Johnnie Beattie scored Scotland's only try of the game, while Leinster's Brian O'Driscoll and Tommy Bowe of the Ospreys were Ireland's scorers.
Parks' right boot proved to be the difference between the two sides, with the Australian-born star contributing 18 points compared to five from Ireland outside-half Jonathan Sexton and the same number from his replacement Ronan O'Gara.
Scotland led 14-7 at the break but Ireland had pegged them back to 20-20 with seven minutes left to play.
And having failed to defeat Wales, Italy and England in similarly tight encounters earlier in the tournament, Scottish fans could have been forgiven for thinking their side might let victory slip from their grasp once more.
But the travelling support needn't have worried as Parks kept his nerve to supply a memorable finale when Leinster's Rob Kearney was penalized for holding on inches from the left-hand touchline.
The defeat was Ireland's first home loss under Declan Kidney and just their second defeat in 15 months.
It ensured Scotland avoided the Wooden Spoon for finishing bottom of the table and also spoilt an anticipated Irish party as they bid farewell to their temporary Croke Park home.
Guinness PRO12
Suite 208, Alexandra House,
The Sweepstakes
Ballsbridge, Dublin 4, Ireland