The visitors received a bit of good fortune in the early stages of the game, with Georgios Efrem's effort cannoning off the bar and appearing to bounce over the line but no goal was given, with technology not in use.
Steve Clarke's side took full advantage shortly after, with Ryan Christie shifting the ball onto his left foot 20 yards from goal and bending an exquisite shot into the top corner to break the deadlock.
Efrem got his name on the scoresheet just after half-time to level things up, picking up a poorly-cleared free kick and striking a fine volley into corner of the net.
Parity was short-lived, though and John McGinn latched onto Greg Taylor's cross and volleyed his side to a rare away win.
Elsewhere in Scotland's group, Belgium confirmed top spot with a crushing 4-1 away win over Russia.
The clinical visitors stormed into a 3-0 lead thanks to two brothers, with Thorgan Hazard opening the scoring and Eden following up with two more of his own.
Romelu Lukaku's superb strike from distance made it four before Giorgi Jikia pulled one back to restore some pride for the hosts.
Wales kept their hopes of qualification for the Euros alive with a 2-0 win over Azerbaijan and set up a huge clash with Hungary on Tuesday.
Kieffer Moore and Harry Wilson got the goals for the visitors in Baku and Ryan Giggs' side now sit one point behind the Hungarians whom they host in the upcoming round of fixtures.
Wales' cause was helped by Croatia, who rounded off their qualification campaign with a 3-1 home win over fourth-placed Slovakia. It was the visitors who led at half-time but strikes from Nikola Vlasic, Bruno Petkovic and Ivan Perisic on the scoresheet.
Elsewhere in the later kick-offs, Kazakhstan emerged 3-1 victors from their trip to San Marino and Slovenia triumphed 1-0 over Latvia.
In the evening action, David Alaba was on target as Austria downed North Macedonia 2-1 and Poland came away from their trip to Israel with a 2-1 victory.