Chris Coleman claimed his first win as Wales boss in Cardiff on Friday night - and heaped even more pressure on Scotland manager Craig Levein.
- Related Content
With both teams starting the night in need of a first Group A victory, it was the Scots who took a first-half lead through James Morrison.
But hopes of a morale-boosting win were shattered in the second half when star man Gareth Bale won and converted a penalty, before snatching the winner with a minute to go.
The win sees Wales take their first points of the campaign and move above Scotland, who have just two points from three matches.
Wales were led by new captain Ashley Williams - who took over the armband from Aaron Ramsey - as the home side made four changes from the 6-1 drubbing in Serbia.
In place of injured goalkeeper Boaz Myhill and defender Adam Matthews, Lewis Price and debutant Ben Davies came into the team, along with midfield pair David Vaughan and Joe Ledley.
Scotland were boosted by the return of Darren Fletcher and Steven Fletcher following lengthy absences from the national team.
Skipper Darren was back after almost a year on the sidelines with a chronic bowel complaint, while on-form Sunderland striker Steven ended his international exile after resolving a long-running dispute with Levein.
Celtic duo Scott Brown - who missed the last double-header with an ongoing hip problem - and late call-up Kris Commons both started, along with Danny Fox, who was also drafted into the side following the draw with Macedonia.
Both sets of players took to the pitch for the national anthems wearing pink ribbons as a mark of respect for missing Welsh girl April Jones.
The match then began at a frantic pace with the visitors exerting some early pressure before Bale hooked over from distance with the first real chance of the match.
The Tottenham man then came much closer to opening the scoring with a curling drive that fell across the face of goal and just inches past the far post.
At the other end, Alan Hutton had a go from the edge of the area with a shot that dipped well over the crossbar and failed to test Price.
Wales still looked dangerous and Brown was called into action to snuff out the danger after Ramsey embarked on a surging run into the box.
The ball broke for Joe Allen but Gary Caldwell was also alert to block the effort.
Steve Morison then passed up a great chance to break the deadlock when he nodded wide from a lovely Bale cross from the right and it was an opportunity they would be left to rue as Scotland surged into the lead seconds later.
Goalkeeper Allan McGregor punted a long ball up the pitch which was met by Steven Fletcher who flicked on for Morrison to drive home with a cool finish with 27 minutes on the clock.
Steven Fletcher could have added his own name to the scoresheet but connected awkwardly with an inviting cross from Fox and the chance was lost.
Bale was causing plenty of problems with his pace and delivery and another impressive cross found Ramsey but he blasted over with half-time approaching.
Scotland also passed up a decent chance just before the break when Steven Fletcher again nodded down for Morrison but, this time, he volleyed over.
The Scots made a change at half-time when Brown, clearly still troubled by his injury, was replaced by Charlie Adam.
Wales tried to haul themselves back into the game in the second half and claimed for a penalty when Ramsey went to ground under pressure from Adam but there was no spot-kick from the German referee.
Morrison had another chance to leave the net bulging with a point-blank effort that stung the palms of the Wales goalkeeper.
Ramsey should have levelled for the home side when he burst through on goal with only McGregor to beat but the goalkeeper raced off his line to block with his legs.
The Scots thought they had doubled their lead when Steven Fletcher bulleted a header into the back of the net.
But the assistant referee deemed Adam's cross had swerved out of play and the effort was disallowed, although television pictures suggested this may not have been the case.
Wales were back on level terms with 10 minutes to go when Maloney was deemed to have fouled Bale in the box, and the winger brushed himself off to rifle past McGregor from the penalty spot.
Hutton then fired just over as the Scots searched for a late winner but the honours went to Wales instead with a minute to go when Bale curled a left-foot shot past McGregor to claim a last-gasp win.