
A close-range strike by Andy Dorman in the last minute gave St Mirren a hard-fought victory over Kilmarnock in the Co-operative Insurance Cup third round.
St Mirren had the upper hand in the first half, but the home side had the better chances, notably through Conor Sammon and striker Kevin Kyle.
Stephen McGinn drove the opener in 63 minutes for the Buddies before Kyle headed a late equaliser for Killie.
But with the match heading for extra-time, Dorman's shot won the tie.
The Buddies' midfield dominated the early exchanges, but St Mirren number one Paul Gallacher was the busier goalkeeper.
First he saved a Conor Sammon overhead kick, then moments later a Kevin Kyle header from a left-foot cross by Garry Hay hit the Buddies' post.
In the second period the visitors continued to pester the Killie defence, which was minus injured Tim Clancy and Simon Ford, and Dorman, a 60th-minute sub for Garry Brady, brought the best out of Mark Brown moments before the Saints took the lead.
The St Mirren goal came when McGinn drove the ball from the edge of the box beyond Brown for his fourth of the season, and his third against Kilmarnock.
David Fernandez squandered the chance to equalise for Kilmarnock, hesitating when he ought to have done better against Gallacher.
And with Kilmarnock pressing, Gus MacPherson's side were ready to pounce on the counter-attack and did so with eight minutes remaining when Dorman raced in on goal but found Brown equal to his shot.
Kyle came to the Ayrshiremen's rescue late in the game, powering a header beyond Gallacher and it looked like the game would go into 30 minutes of extra-time.
Then, incredibly, Dorman snatched a last-gasp winner to put Saint Mirren into the last eight of the tournament.
St Mirren manager Gus MacPherson: "It was a game that could have gone either way. Kilmarnock have that aerial threat. At every opportunity they try to get the big men forward.
"Andy Dorman was similar last season: he was slow to start. He had a very good chance at 1-0 when he tried to be too cute, but he learned from it and the next chance he buried.
"Stephen (McGinn) is maturing, taking the responsibility. He has got the number four jersey and we have wanted him to take confidence from that and he is learning all the time."
Kilmarnock manager Jim Jefferies: "They were stunned by the late equaliser and I thought we would go on (to win).
"We had a couple of great opportunities in behind them to get decent balls in but we didn't put in the final ball that Kevin (Kyle) was looking for.
"I thought St Mirren were the better side in the first half. We've not played as well as we have been playing. The second half was a bit better and we pushed to get a goal.
"I would have fancied us if it had gone to extra-time because I think St Mirren were rattled.
"There is very little between the teams. It's been a struggle the last few years here but we'll do the best we can and we'll bounce back on Saturday."