The summer arrival from Kilmarnock sealed the points on the hour-mark to lift the hosts to fifth in the table after James Collins had fired them into a deserved early lead.
Liam Craig fired the first warning shot as he dragged wide and Collins soon opened the scoring in the 10th minute – nodding home Michael Nelson’s flick-on from a free-kick.
Collins was close to doubling the advantage in the aftermath when he fired over from distance, and Scott Robertson was inches off-target with a header as Saints struggled to cope with the pressure.
Visiting goalkeeper Christopher Dilo had to be at his best to deny first Craig and then Robertson either side of half-time with the one-way traffic continuing into the second period.
It was left to Heffernan to grab the crucial second goal in the 61st minute – easily tapping home an excellent cross from Robertson with the Saints defence conspicuous by their absence.
Only an offside flag denied the striker a quick-fire second, and Collins had the ball in the net 15 minutes before time only for the referee’s assistant to once again spoil the party.
It got worse for Saints when Danny Grainger was shown a second yellow card and a consequent red five minutes from time but there were no further goals, with Dilo saving well from substitute Rowan Vine at the death.