The lively Ikechi Anya's expertly-taken goal just before the hour mark had given the visitors the lead, but Jovan Kostovski looked to have shared the spoils, bundling in a sublime Goran Pandev pass late on to equalise.
However Maloney had other ideas, curling a brilliant set piece past Tomislav Paèovski in the host's goal to send the Tartan Army into raptures, and move the Scots off the bottom of the group.
Scotland dominated for long periods of the first-half, with Anya a real outlet down the left, and Steven Naismith leading the line with real confidence.
Anya was creating space well, forcing Paeovski into several low blocks with Naismith lurking.
Naismith created the visitors best chance of the opening period, lofting a pinpoint ball over the Macedonian backline for Scott Brown to run onto, but the Scots skipper couldn't beat Paèovski, who saved well.
The home side could have snatched an undeserved opener just before the break, but Adis Jahovic lashed a shot into the side netting, with others well-placed for a pullback.
But it Gordon Strachan's men who deservedly took the lead, with impressive Anya finishing brilliantly from an acute angle after being played in.
The goal did spark the home side into life, but they found Matt Gilks in fine form after coming on at half-time in the Scotland goal.
The Blackpool goalkeeper tipped three goalbound efforts over the ball to keep the Scots in front, but he was powerless to keep the Macedonians at bay all night, especially with the talented Pandev around.
The Napoli man's delightfully chipped throughball undid the Scotland defence, allowing Kostovski to bundle in an equaliser which seemed to have sealed a point for the hosts.
But Maloney had other ideas, curling a pinpoint free-kick into the top corner after James McArthur's forward run had been halted on the edge of the box to earn Strachan his second victory in charge, and a brighter future in prospect for their long-suffering fans.