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.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.