St Mirren won their first league match in seven, beating ten-man Dundee to stretch the difference between the two bottom clubs to four points.
The game changed with the first-half dismissal of Dundee striker Colin Nish, sent off for a foul on Paul Dummett.
Steven Thompson scored from close range to put the Buddies ahead, but a Ryan Conroy penalty levelled the match.
But a second from Thompson and a late strike from Dougie Imrie earned Saints the points.
St Mirren had gone into the match on the back of six straight defeats in the league, while Dundee were unbeaten in three, a run of form which saw the bottom side come within a point of the Paisley side.
The early stages were full of long-range efforts as both sides tried to test the opposition keepers, Kenny McLean and Nicky Riley both going close.
Nicky Riley was looking lively for Dundee and his long, high cross was met by the head of Colin Nish, but went straight to Craig Samson.
But the pattern of the game changed radically when Nish was shown a straight red card for a studs-up challenge on St Mirren left-back Paul Dummett.
St Mirren took advantage of the extra man shortly after, when Thompson pounced on the rebound after Lewis Guy rounded Douglas and flashed a shot across the face of goal.
The former Scotland striker was left with a tap-in from a couple of yards out and made no mistake.
It could have been two when McLean released Dummett with a defence-splitting pass, but the full-back was too busy thinking of his next move and failed to control the ball.
The home side dominated the tail end of the second half, and veteran keeper Douglas pulled off a wonder save from a delicately-chipped McGinn shot from the edge of the box.
Although St Mirren continued to dominate possession against the ten men, the visitors were occasionally able to break with Riley stinging the palms of Samson with a powerful shot.
But it was largely one-way traffic towards the Dundee goal and Gary Teale hit the side netting with a near-post drive which had Douglas beaten.
St Mirren looked like they wanted the second goal to kill the game and McLean flashed an effort just wide before Douglas pulled off another great save from a close-range Thompson header.
And they were made to pay with their profligacy when Goodwin was adjudged to have handled in the box.
Ryan Conroy converted the penalty to bring the ten men back into the match.
The home side were still in control of possession, however, and Thompson settled nerves when he headed a Gary Teale free-kick past Rab Douglas to restore St Mirren's lead.
Dundee heads went down after battling against the numerical odds for so long, and Dougie Imrie piled on the misery when he controlled the ball in the box and coolly slotted the ball past Douglas to seal the points.
Live Text Commentary
Full Time The referee blows his whistle to end the game.90:00 +1:47
Corner taken right-footed by Gary Teale, clearance made by Gary Irvine.89:44 Substitution
Substitution Nicky Riley leaves the field to be replaced by Martin Boyle.86:48
Assist on the goal came from Marc McAusland.86:48 Goal scored
Goal! - Dougie Imrie - St Mirren 3 - 1 Dundee Dougie Imrie gets on the score sheet with a goal from inside the box to the bottom left corner of the goal. St Mirren 3-1 Dundee.84:11
Inswinging corner taken right-footed by Gary Teale, Ryan Conroy manages to make a clearance.82:20
Gary Teale takes the inswinging corner, Gary Irvine makes a clearance.81:19
Inswinging corner taken left-footed by Dougie Imrie from the right by-line, clearance by Iain Davidson.79:27
Gary Irvine concedes a free kick for a foul on Steven Thompson. Paul Dummett takes the direct free kick.78:35 Substitution
Substitution Steven Milne leaves the field to be replaced by John Baird.77:35
David van Zanten challenges Ryan Conroy unfairly and gives away a free kick. Ryan Conroy takes the direct free kick.75:33
Paul Dummett gives away a free kick for an unfair challenge on Steven Milne. Declan Gallagher restarts play with the free kick.73:25 Substitution
Substitution Lewis Guy goes off and Sam Parkin comes on.73:25 Substitution
Substitution Dougie Imrie on for John McGinn.71:15
The assist for the goal came from Gary Teale.71:15 Goal scored
Goal! - Steven Thompson - St Mirren 2 - 1 Dundee Steven Thompson grabs a headed goal from deep inside the penalty area. St Mirren 2-1 Dundee.70:51
Handball decision goes against Gary Irvine. Gary Teale takes the direct free kick.69:36
Lewis Guy is caught offside. Indirect free kick taken by Kyle Benedictus.67:28
Inswinging corner taken from the right by-line by Gary Teale, clearance made by Rab Douglas.65:28
Lewis Guy is caught offside. Declan Gallagher restarts play with the free kick.
Goal! - Ryan Conroy - St Mirren 1 - 1 Dundee Power penalty scored by Ryan Conroy. St Mirren 1-1 Dundee.63:11
The referee penalises Jim Goodwin for handball.62:17
Foul by John McGinn on Kevin McBride, free kick awarded. Ryan Conroy takes the free kick.60:32
Free kick taken by Kyle Benedictus.60:32 Booking
Booking Paul Dummett is given a yellow card.60:25
Foul by Paul Dummett on Nicky Riley, free kick awarded.59:23
Steven Thompson takes a shot. Save by Rab Douglas.58:26
Kenny McLean produces a left-footed shot from the edge of the box and misses to the left of the target.56:51
Corner taken by Ryan Conroy from the right by-line, Kyle Benedictus has a headed effort at goal from close range which goes wide of the left-hand post.56:15
Free kick awarded for an unfair challenge on Steven Milne by Jim Goodwin. Kevin McBride takes the free kick.55:40
Free kick awarded for a foul by Iain Davidson on John McGinn. Lee Mair restarts play with the free kick.53:49
Shot from just outside the penalty box by Gary Teale misses to the left of the target.53:12
Gary Teale takes the inswinging corner, James McAlister makes a clearance.51:45
Nicky Riley produces a drilled right-footed shot from 30 yards. Save by Craig Samson.50:46
Nicky Riley fouled by John McGinn, the ref awards a free kick. Free kick taken by Ryan Conroy.49:50
Jim Goodwin concedes a free kick for a foul on Nicky Riley. Gary Irvine restarts play with the free kick.47:49
David van Zanten produces a right-footed shot from just outside the area that goes harmlessly over the bar.46:54
Corner taken short by Lewis Guy.45:01
The second half begins.45:00 +1:08 Half time
Half Time The first half comes to an end.44:57 +1:00
Corner taken by Gary Teale.44:44
John McGinn takes a shot. Rab Douglas makes a save.41:48
Gary Irvine challenges John McGinn unfairly and gives away a free kick. Paul Dummett takes the free kick.41:21
Gary Irvine has an effort at goal from outside the penalty area which goes wide right of the goal.38:02
Jim Goodwin has an effort at goal from the edge of the area that misses to the right of the target.34:35
James McAlister fouled by David van Zanten, the ref awards a free kick. Direct free kick taken by Ryan Conroy.30:42
Lewis Guy provided the assist for the goal.30:42 Goal scored
Goal! - Steven Thompson - St Mirren 1 - 0 Dundee Steven Thompson grabs a goal from inside the six-yard box high into the middle of the goal. St Mirren 1-0 Dundee.26:23
Direct free kick taken by Craig Samson.26:23 Dismissal
Dismissal Colin Nish is shown a red card.26:22
Colin Nish gives away a free kick for an unfair challenge on Paul Dummett.25:52
Jim Goodwin gives away a free kick for an unfair challenge on Steven Milne. Ryan Conroy takes the direct free kick.22:57
Shot from just outside the area by Gary Teale misses to the right of the target.22:23
Colin Nish challenges Lee Mair unfairly and gives away a free kick. Craig Samson restarts play with the free kick.21:58
Handball decision goes against Jim Goodwin. Iain Davidson takes the direct free kick.19:33
Colin Nish fouled by Lee Mair, the ref awards a free kick. Iain Davidson restarts play with the free kick.18:46
Paul Dummett has shot on goal from just outside the box which goes wide of the right-hand upright.17:46
Colin Nish takes a shot. Save made by Rab Douglas.13:36
Declan Gallagher fouled by Steven Thompson, the ref awards a free kick. Rab Douglas restarts play with the free kick.12:32
Corner taken right-footed by James McAlister from the left by-line, save by Craig Samson.11:55
Inswinging corner taken from the right by-line by James McAlister, Lee Mair manages to make a clearance.8:15
Steven Thompson takes the chance to get an effort at goal. Rab Douglas makes a save.7:42
Free kick awarded for an unfair challenge on Jim Goodwin by Colin Nish. Direct free kick taken by Marc McAusland.7:11
Kenny McLean has an effort at goal from outside the box which goes wide right of the target.4:56
Jim Goodwin fouled by Steven Milne, the ref awards a free kick. David van Zanten restarts play with the free kick.4:22
John McGinn has a drilled shot. Save by Rab Douglas.2:56
Shot from just outside the box by Nicky Riley goes over the target.2:24
Free kick awarded for an unfair challenge on Steven Thompson by Iain Davidson. Direct free kick taken by Jim Goodwin.1:25
Inswinging corner taken by John McGinn from the right by-line played to the near post.0:28
Free kick awarded for an unfair challenge on Gary Irvine by Kenny McLean. Gary Irvine takes the direct free kick.0:00
The referee gets the game started.
Live data and text provided by our data suppliers