A John Sutton double secured St Mirren's Bank of Scotland Premier League status after an impressive comeback victory over Motherwell which ultimately proved harmless for the Steelmen.
Ross McCormack grabbed his first two SPL goals for Well either side of half-time as Well cruised towards the point they required to stay up.
Saints subs Sutton and Billy Mehmet turned the game on its head - but Dunfermline's defeat at Inverness meant both sides stay up.
The Love Street men celebrated at the end of a pulsating 90 minutes but many Well fans marked their escape by calling for manager Maurice Malpas's head.
Malpas had taken a huge gamble by making seven changes after a run of one win in 10 league games dragged them into the relegation mire.
Three were enforced with Scott McDonald and Mark Reynolds suspended and Jim Paterson injured but Graeme Smith, Brian Kerr, David Clarkson and Darren Smith were all dropped.
Among those coming in were centre-back Willie Kinniburgh, who was making his first appearance of 2007, while McCormack started his first game for two months following an ankle injury.
Neither side committed themselves in the opening stages but Motherwell lifted their fans with a decent attack in the 10th minute.
The unchanged Buddies had wingers Mark Corcoran and Alan Reid supporting Stewart Kean and Alex Burke, but they initially struggled to get hold of the ball in central midfield.
However Well were giving the ball away cheaply too and neither side could carve out an opening.
Corcoran and McCormack both wasted free-kicks and McGarry's weak 20-yard effort forced the first save midway through the half.
Kinniburgh twice cleared brilliantly to prevent Corcoran's crosses reaching Kean and Paul Quinn hauled down Kirk Broadfoot as Saints had a two-on-one attack in the only time the game opened up in the opening half.
Kean's shot on the turn that flashed wide was the closest Saints came but Motherwell took the lead in the 38th minute when McCormack headed home after McBride had nodded Keegan's cross into the six-yard box.
McCormack, whose first season at Well has been ruined by illness, was heavily involved in a good break at the start of the second half which ended with Smith turning McBride's strike behind for a corner.
And the striker grabbed his second with a measured 49th-minute penalty after referee Mike Tumilty controversially ruled that Andy Millen had handled as he tried to clear McBride's corner.
With bottom side Dunfermline one goal ahead at Inverness, Gus MacPherson wasted no time in going for broke by bringing on strikers Sutton and Mehmet for Burke and Millen.
But not even the Saints boss could have dreamed of the impact. Sutton immediately gave his side a lifeline in the 56th minute - although the goal owed more to the recalled Meldrum, who let the striker's weak header from a Reid cross slip through his fingers and his legs.
Incredibly, Mehmet levelled three minutes later with a composed finish after Broadfoot had set him up following a long throw.
Malpas brought on Brian McLean at right-back for his first appearance since suffering a cruciate ligament injury in September, with Martyn Corrigan pushed into midfield.
McCormack came close to his hat-trick with two brilliant long-range strikes which Smith tipped over.
But with the Saints fans cheered by an Inverness equaliser, the visitors pushed for a winner and Meldrum pushed Sutton's header on to the bar before Well scrambled the ball clear.
And Sutton crashed the clincher home in the 84th minute with a brilliant left-footed strike into the roof of the net after the ball fell for him at a corner.
McCormack had a great chance to level in injury-time but pulled his shot wide.
Saints' joy intensified as Inverness grabbed a winner which keeps both sides up - but calls rang out for the head of Malpas.
Teams
Motherwell Meldrum, Corrigan, Craigan, Kinniburgh, Quinn,McBride, Fitzpatrick, Vadocz, McGarry (McLean 63), McCormack,Keegan (Clarkson 79).
Subs Not Used: Graeme Smith, Kerr, Darren Smith, Connolly,
Jamie Murphy.
Booked: Quinn, Corrigan.
Goals: McCormack 38, 49 pen.
St Mirren Smith, van Zanten, Potter, Broadfoot, Maxwell,Corcoran, Murray, Millen (Sutton 54), Reid, Kean,Burke (Mehmet 54).
Subs Not Used: Hinchcliffe, Brady, Mackay, McKenna, McGinn.
Booked: Broadfoot.
Goals: Sutton 56, Mehmet 59, Sutton 84.
Att: 9,277
Ref: M Tumilty (Scotland).