The Dons were profligate in the first half, with McGinn twice denied by Alan Mannus, before the Northern Irishman scored from a free-kick after 63 minutes.
McGinn's 11th of the season followed after 81 minutes as Aberdeen defied incessant horizontal rain to end a three-match winless run in the Clydesdale Bank Premier League and climb to fourth, above Saints, who are without a win in four.
Aberdeen made a strong start as Saints played towards the worst of the elements. Mannus saved a 25-yard shot from McGinn which swerved in the wind and then scrambled away the follow-up from Josh Magennis before the ball broke for Mitchel Megginson, whose effort deflected wide.
The Dons seemed certain to score when Megginson whipped the ball towards the far post, with Rory Fallon unmarked and poised to nod it in, but Steven Anderson hurled himself at the ball and headed wide as he finished up in the net.
Saints were again indebted to Mannus when he made a point-blank save from McGinn after meeting Magennis' cross from the left.
Liam Craig shot over for Saints after Anderson halted a run by Rowan Vine before Magennis won a free-kick at the other end in a dangerous position.
From 25 yards out on the right, McGinn kept the ball low as he bent it around the wall into the bottom corner for his 10th of the season.
Saints introduced Nigel Hasselbaink alongside fellow substitute Gregory Tade up front in an effort to find the equaliser, but immediately fell two behind.
Jamie Masson threaded the ball from the left through for McGinn to race through and place the ball low beyond Mannus and complete victory.