The former Morton ace got on the end of an excellent Paul McGowan pass to sink the hosts who have now lost their opening three matches.
Promoted Dundee, meanwhile, have six points from four league games after ending their run of three successive draws with their first win.
In the early minutes of the match Saints midfielder Kenny McLean should have done much better when he was played through by Callum Ball but his poor effort flew wide of Kyle Letheren's left-hand post.
Dundee skipper Gary Irvine picked up an early booking following a foul on McLean as St Mirren began to take control of the opening exchanges.
Moments later and the hosts came close to breaking the deadlock when right-back Jason Naismith fired in a low shot which forced Letheren to touch behind for a corner.
After being set up by Gary Harkins, Luka Tankulic had the visitors' first real opportunity only for the Dundee forward to strike a weak shot which was easily handled by Marian Kello.
Shortly afterwards Harkins himself spurned a glorious chance when, unmarked in the box, he failed to find the target.
As the first half progressed the Dark Blues began to threaten the St Mirren goal more often, James McAlister next to test Kello with a shot from just outside the box.
Throughout the opening period McLean was at the heart of the home team's best play and it was he again who came close to opening the scoring after aiming a dangerous effort at the Dundee goal which Letheren turned away.
Almost immediately after half-time, the hosts went close again when Ball got a slight touch on a dangerous cross from Naismith, but he was unable to get enough behind it and the match remained goalless.
At the other end McAlister met a left-wing cross from Irvine only for his attempted header to go way over.
Saints made the first change of the game in the 58th minute when Ross Caldwell came on to replace the ineffectual James Marwood.
Four minutes later and both Paul Hartley and Tommy Craig opted for further changes with MacDonald coming on for Tankulic and Steven Thompson making his first appearance for the Paisley outfit this term when he replaced Ball.
The flurry of substitutions continued with Iain Davidson taking to the field at the expense of Kevin McBride for the visitors.
Getting on the end of McLean cross St Mirren debutant Adam Drury blazed an effort over before the action swung to the other end with MacDonald blasting a fierce effort which Kello could only parry and Jim Goodwin had to be alert to clear from the path of McGowan.
With both sides now in search of that elusive opening goal play swung from one end to the other, with Thompson coming close for the hosts with a powerful finish after meeting a Drury cross.
But, with 10 minutes remaining, it was the visitors who grabbed that all-important strike.
McGowan played in MacDonald with the Dee substitute firing a powerful low shot past the helpless Kello into the bottom right hand corner of the net to send the large travelling support into delirium.
In the closing stages the home time never really troubled the Dundee goal with their final ball continually letting them down while last season's First Division champions looked more likely to double their lead.