Shane Williams touched down under the points almost two minutes after the clock had passed 80 minutes with Scotland, who were down to just 13 players after Scott Lawson and Phil Godman were both sin-binned for professional fouls.
Moments earlier Stephen Jones had kicked three points to seemingly steal a draw for the hosts but the referee, George Clancy, ensured there was to be one final play, which proved enough for Wales to seal a memorable win.
Scotland had started the far brighter and could have gone into half time with more than their eventual 18-9 lead; all the points coming during a meticulous opening 25 minutes with Andy RobinsonÃ¢â‚¬â„¢s team making a mockery of their supposed inability to score tries.
John Barclay opened the scoring after only eight minutes after James Hook and Gareth Cooper simultaneously failed to tackle the open-side flanker, who was left with a clear path to goal from just 15 metres out.
Chris Patterson, playing his 100th cap, slotted the conversion and though the hosts were soon on the scoreboard thanks to a Stephen Jones penalty, Dan Parks restored the 7 point advantage with a drop goal on the 17 minute mark.
And the Australian ex-pat, starting his first Test match in 15, was instrumental in creating the second try with a deft left-footed grubba through to winger Max Evans, who was only on the field as a blood replacement for his brother Thom. Patterson missed the conversion however and it was to be his last major involvement, with a knock he received to his right kidney early in the game ensuring his centenary appearance ended prematurely.
But it seemed for much of the second period that he would at least have a victory to celebrate as Parks, assuming the kicking duties, slotted and early penalty. Scotland also had a Kelly Brown try correctly disallowed early in the second period following a forward pass and the indications were that the visitors were more than capable of securing the win.
Wales dominated possession but it took them until the 55th minute to finally cross the line, Shane Williams brilliantly creating a two on one for Lee Byrne to finish. The try gave the hosts hope, despite Jones missing the conversion, but also seemed to inspire Scotland into life once more with a siege of their own.
Williams was once again the Welsh hero however as the 5Ã¢â‚¬â„¢7 winger somehow rose above a pair of Caledonian forwards to collect a cross-field kick just inches from his own line. The Welshman then sent his mark down towards the half way line, only to see it sail back over his head and between the posts as Parks struck a near perfect drop goal from the Welsh 10 metre line to take the score to 24-14.
And that it seemed, was that. Wales camped out in the Scottish 22 but struggled to break a solid defensive line, aided by some lenient officiating from Clancy who restrained himself from issuing a yellow card, despite numerous infringements.
The Irishman did finally go to his pocket with only a few minutes remaining, sending replacement hooker Lawson to the bin for obstructing scrum-half Richie Rees at the breakdown. Wales Leigh Halfpenny then crossed soon afterwards and had the wherewithal to gallop round and touch the ball down under the posts, ensuring JonesÃ¢â‚¬â„¢ conversion narrowed the deficit just to three points.
The Scots, having looked so assured for most of the game, were suddenly rattled and when Lee Byrne broke the line and chipped ahead, he was cynically tripped by Godman allowing Jones to level the scores.
But Wales were far from satisfied with a point and with space opening up everywhere against just 13 men, the hosts patiently went through the phases before Stephen JonesÃ¢â‚¬â„¢ cross field kick found Leigh Halfpenny who scrambled within metres of the line. Andy Powell then made an unsuccessful lurch for glory before Rees fed Williams for his 49th Welsh try right under the posts.
Scotland were understandably devastated by a finale which Robinson described as Ã¢â‚¬Å“suicide,Ã¢â‚¬Â and their mood will have been dampened further by the news that Thom Evans, who was stretchered off in the first half after a collision with Lee Byrne, has had to undergo neck surgery.
MORE: The latest football news
MORE: The latest tennis news
BIOGRAPHY: Daniel Sturridge
BIOGRAPHY: Kepa Arrizabalaga