Substitute Chris Kane scored a stoppage-time winner as St Johstone beat 10-man Motherwell 2-1.
Kane flicked home Jason Kerr's near-post cross and was joined in his celebrations by all of his team-mates, including goalkeeper Zander Clark.
Clark was no doubt the most relieved man inside McDiarmid Park after his blunder allowed Christopher Long to equalise five minutes after Motherwell had gifted Callum Hendry a well-taken opener.
The visitors had substitute Christy Manzinga sent off following a penalty-box dive with eight minutes left and they could not hold out after losing third place in the Ladbrokes Premiership to Aberdeen on Tuesday.
There was little between the teams before the 27th-minute opener. Long came close from 25 yards and Drey Wright volleyed over a difficult chance at the other end.
Motherwell were punished after Liam Donnelly took a heavy touch and lost possession midway inside his own half after receiving the ball from goalkeeper Mark Gillespie.
Donnelly and another team-mate's attempts to win the ball back off Hendry only served to set up the striker and he drove the ball into the bottom corner from 18 yards. It was the forward's seventh goal from a season in which he has started seven matches.
Saints soon returned the favour. Kerr put in a good tackle on Allan Campbell to prevent the midfielder running on to Mark O'Hara's threaded pass and Long struck the loose ball first time from 25 yards.
The shot appeared to take a slight deflection off Liam Craig but the backtracking Clark appeared to be well-placed to save. However, the goalkeeper bent down and saw the shot slip under his hand and trundle in off the post.
Motherwell had a good chance after a long throw moments later but Jermaine Hylton hooked wide from inside the six-yard box after a long throw.
Saints came back into it and Gillespie spilled Ali McCann's shot but Motherwell escaped.
Long had a shot diverted wide early in the second half but he was forced off with a knock in the 64th minute. Former Saints striker Tony Watt came on for his first league appearance for Motherwell but the hosts were creating the better chances.
Liam Grimshaw's sliding clearance prevented David Wotherspoon knocking home from close range after Anthony Ralston got in behind and drilled the ball across the goalmouth.
The unmarked Hendry had a volley blocked after a long free-kick and Kerr headed Wright's cross against the outside of the post.
Manzinga had come on in the 69th minute, been booked for a foul on Ralston in the 77th minute and then launched himself over McCann's leg to receive a red card.
The visitors put in some good blocks to deny substitute Matt Butcher and Wright and they also had a handball claim denied when Kerr blocked O'Hara's shot in the box.
But Kane pounced in front of Peter Hartley to beat Gillespie at his near post in the third minute of time added on.