Jack Ross’ struggling side were the surprise winners on Tayside thanks to goals in either half from striker John Sutton and defender Jack Baird.
Saints have had a tough season up until now but forgot about being seven points adrift at the foot of the Championship to leave Paul Hartley’s Premiership hopefuls deflated.
Dundee were missing suspended skipper Darren O’Dea but were still heavily expected to proceed at the expense of their struggling opponents.
As early as the fourth minute, Tom Hateley slipped in Marcus Haber with a neat reverse pass.
Canadian international Haber hit a fierce shot which cannoned back off the bar with St Mirren keeper Billy O’Brien beaten.
A few minutes later, Mark O’Hara set up Faissal El Bakhtaoui but his shot went high over on-loan Manchester City keeper O’Brien’s bar.
Dundee threatened again midway through the first half when Cammy Kerr’s left-foot shot from 25 yards was tipped round the post by O’Brien.
However, Saints took the lead against the run of play on 24 minutes.
Sutton, formerly of Dundee, picked up on a loose ball just inside the box, before steadying himself and slotting a fine finish low past Dundee keeper Scott Bain.
That gave the visitors the confidence to attack more freely and, on 36 minutes, Kyle McAllister fired narrowly over Bain’s bar.
But Haber ought to have equalised on 39 minutes. Kevin Holt’s curled cross looked perfect for the big striker but somehow he headed wide from eight yards.
At the start of the second half, though, Saints increased their lead in simple fashion.
Stephen Mallan got by Dundee striker Craig Wighton on the edge of the penalty area and his cut-back was swept high into the top corner by Baird.
From then on, Dundee huffed and puffed but could not find a way past their lower league opponents and left the field to a chorus of boos from the home supporters.