Liam Millar’s goal three minutes from time earned Kilmarnock a 1-0 win away at struggling St Mirren.
The last-gasp effort secured Killie’s first victory in nine matches and denied St Mirren the point they needed to climb off the foot of the Ladbrokes Premiership table.
The substitute turned in Eamonn Brophy’s attempted shot at the back post to break the deadlock in the 87th minute.
It was Kilmarnock’s first goal in six games and moves them to within a point of Aberdeen in third place.
St Mirren had been forced into a late change just before kick-off, with captain Stephen McGinn injured in the warm-up and replaced in the starting line-up by Cammy MacPherson.
In torrential rain, both sides struggled to get into any sort of rhythm.
Kyle McAllister came close for the home side with the first chance of the game but could not get his shot on target, while Kilmarnock responded with a Chris Burke long-range effort that was comfortably gathered by Vaclav Hladky.
McAllister then sent Simeon Jackson running in on goal with an exquisite pass but the Canadian striker could not get enough purchase in his shot to beat Daniel Bachmann.
A competitive but uneventful first half concluded with a free-kick for Kilmarnock that Brophy sent over the bar from 25 yards.
It was more of the same in the second half, both sides gamely trying to play a passing game of football in conditions that made it almost impossible.
St Mirren pushed forward at the start of the half, and a sweeping passing move concluded with Ethan Erhahon seeing his shot well saved by Bachmann.
Kilmarnock responded with a Burke effort that flew wide from about 30 yards, before they almost broke the deadlock after 51 minutes.
Brophy still had plenty to do as he received the ball in the St Mirren penalty box with his back to goal, but the forward was able to turn and get his shot away only to see it strike the post before being cleared.
Stuart Findlay was then involved in chances at both ends within a matter of 30 seconds.
After seeing his header at goal easily collected by Hladky, he sprinted 90 yards back to block Jackson as he prepared to shoot following a quick St Mirren counter.
With the game petering out, Brophy crossed perfectly from wide on the right wing and Millar was alert enough to turn it in.