All the goals arrived during the closing quarter of an hour, with John Sutton opening the scoring from the penalty spot before an own goal by Mark O’Brien and a long range effort by Stephen Mallan sealed three points for already relegated Saints.
Sutton made the breakthrough 15 minutes from time after Lee Erwin had been brought down by Thomas Reilly.
Shortly afterwards, Erwin went close to adding a second for Motherwell before Saints levelled matters six minutes from time when O’Brien got the final touch after keeper George Long had made a mess of dealing with Jason Naismith’s lobbed cross.
With 89 minutes on the clock, Scott McDonald was shown a straight red card for elbowing Reilly and deep into injury time, Mallan collected Kieran Sadlier’s assist before brilliantly smashing the ball into the top left corner from 25 yards.
In a goalless first half, St Mirren missed a great chance as early as the third minute when Mallan’s free-kick fell to Sean Kelly at the back post, only for the unmarked midfielder to clip the ball wide.
McDonald failed from close range for Motherwell, as did Marvin Johnson who saw his effort saved by Marian Kello.
In an end-to-end first 45 minutes, Alan Gow went close for Saints along with Kelly who missed again as he ballooned over from close range.
At the other end, Erwin failed to connect properly from 10 yards and keeper Kello managed to clear the ball off his own line.
And the chances continued to come and go after the break. First, Motherwell keeper George Long saved well from James Dayton before Erwin headed over for the visitors.
Kello denied McDonald who shortly afterwards headed inches wide, while Sutton flashed an effort wide for Well.
But the real action of the afternoon was just starting and despite Sutton’s opening goal, it was the Buddies who bounced back to leave Motherwell out of time and facing a play-off encounter against either Hibernian, Rangers or Queen of the South.