Lee Mair scored in stoppage time against doughty Hamilton Accies to take St Mirren into the quarter-finals of the Scottish Communities League Cup.
There wasn't much for either side's fans to cheer about in a goalless first half in Paisley.
Chances weren't forthcoming for most of the second 45 and, with two minutes of added time, extra-time loomed.
But Mair latched onto a corner from Graham Carey to guide the ball past goalkeeper Kevin Cuthbert.
The Buddies should have broken that deadlock as early as the opening minute, when Kenny McLean burst into the box only to drag his shot just wide of the upright.
Hamilton also should have opened the scoring when Louis Longridge raced on to a James Keatings ball and sent his effort fizzing across the face of goal and wide when he should have hit the target.
St Mirren were threatening again when what appeared to be a harmless cross come shot from Dougie Imrie took a major deflection and a full-stretch Cuthbert was called into action to tip just over.
Home manager Danny Lennon made his first change 10 minutes before the break when Lewis Guy was replaced by Thompson, with it unclear whether the substitution was down to injury or not.
With the tie still deadlocked at half-time following a fairly drab first half, the Buddies made another switch for the second half, with McLean making way for David van Zanten.
Jim Goodwin could have sparked the match into life shortly after the restart but sent his angled drive blazing over the bar instead as both sides struggled to find the opener.
The Buddies looked slightly more threatening in front of goal and a thunderous 25-yard free-kick from Carey forced an impressive save from Cuthbert.
Accies' goalkeeper came to the rescue again moments later, this time to tip a close-range header from Carey past the post as the home side pushed for a late winner.
St Mirren's pressure finally paid off deep into injury time when Mair threw himself in front of Carey's corner and his header found the back of the net with seconds to go.
St Mirren manager Danny Lennon : "We're delighted. It was a very hard obstacle Hamilton put in front of us.
"They had a very good organised set-up and great energy within their team.
"It was like chopping down a big old oak tree. We kept chopping and chopping and chopping and finally, on the last swing, it collapsed and we got the goal.
"We've got to another quarter-final and hopefully we can take it one step further."
Hamilton Academical manager Billy Reid : "I can't be negative on anything to be honest with you.
"We set out with a purpose of how we were going to play and I thought we were brilliant in the first half and were the better side.
"Some of our passing was absolutely magic. We were miles better in the first half and should have scored.
"They changed their formation a bit in the second half and we couldn't keep the ball as much and they bombarded us with long balls into the box.
"We dealt with almost everything and then lost the goal with the last kick of the ball. But it's all plusses for us."
- 01 Samson
- 03 Dummett
- 05 Mair
- 14 McAusland
- 06 Goodwin
- 10 McGowan
- 11 Carey
- 17 Mclean (van Zanten - 46' )
- 07 Imrie
- 19 Parkin
- 27 Guy (Thompson - 35' )
- 12 Smith
- 02 van Zanten
- 23 Barron
- 21 Teale
- 09 Thompson
- 01 Cuthbert
- 03 Hendrie
- 04 Canning
- 05 Michael Devlin
- 08 Fisher (Gordon - 61' Booked )
- 02 Gillepsie
- 06 Routledge Booked
- 07 Crawford
- 10 Neil
- 11 Longridge
- 09 Keatings (Ryan - 85' )
- 17 Christie
- 12 Gordon
- 14 McGlinchey
- 15 Ryan
- 16 Fraser
Live Text Commentary
Full Time The referee signals the end of the game.90:00 +1:48
The assist for the goal came from Graham Carey.90:00 +1:48 Goal scored
Goal! - Lee Mair - St Mirren 1 - 0 Hamilton Lee Mair fires in a goal from inside the area high into the middle of the goal. St Mirren 1-0 Hamilton.90:00 +0:54
Corner taken left-footed by Graham Carey from the left by-line, save by Kevin Cuthbert. Corner taken by Graham Carey,88:47
Foul by Paul McGowan on Jon Routledge, free kick awarded. Kevin Cuthbert takes the free kick.87:48 Booking
Booking Caution for Jon Routledge.86:23
Corner taken by Graham Carey from the right by-line, Michael Devlin makes a clearance.85:47
Grant Gillespie gives away a free kick for an unfair challenge on Dougie Imrie. Indirect free kick taken by Paul Dummett.84:45 Substitution
Substitution Andy Ryan is brought on as a substitute for James Keatings.83:28
Graham Carey delivers the ball from the free kick left-footed from left wing, Alex Neil manages to make a clearance.83:28 Booking
Booking Ziggy Gordon receives a caution.83:19
Foul by Ziggy Gordon on Paul Dummett, free kick awarded.81:27
Inswinging corner taken right-footed by Paul McGowan from the left by-line, clearance by Martin Canning.78:28
Short corner taken by Ali Crawford from the right by-line.78:07
Unfair challenge on Grant Gillespie by Graham Carey results in a free kick. Free kick taken by Martin Canning.77:31
Effort from outside the penalty area by Jim Goodwin goes wide left of the target.76:03
Inswinging corner taken by Graham Carey from the right by-line, Lee Mair takes a shot. Save by Kevin Cuthbert. Graham Carey takes the inswinging corner, Kevin Cuthbert makes a save.71:07
The offside flag is raised against Steven Thompson. Kevin Cuthbert restarts play with the free kick.69:22
Free kick awarded for an unfair challenge on Steven Thompson by Michael Devlin. Graham Carey produces a strike on goal direct from the free kick, save by Kevin Cuthbert. Graham Carey decides to take the corner short.64:45
David van Zanten concedes a free kick for a foul on Ali Crawford. Free kick taken by Steven Hendrie.
The assistant referee signals for offside against Steven Thompson. Kevin Cuthbert takes the indirect free kick.60:12 Substitution
Substitution Ziggy Gordon replaces Gary Fisher.58:44
Free kick awarded for an unfair challenge on Sam Parkin by Martin Canning. Free kick crossed by Graham Carey, clearance made by Alex Neil. Corner taken by Graham Carey, clearance by Michael Devlin.55:25
Unfair challenge on Grant Gillespie by Steven Thompson results in a free kick. Kevin Cuthbert takes the indirect free kick.55:10
David van Zanten fouled by Ali Crawford, the ref awards a free kick. Indirect free kick taken by Jim Goodwin.52:24
Shot by Jim Goodwin from outside the box goes high over the crossbar.51:14
Effort by Marc McAusland from a long way out goes over the target.50:26
Unfair challenge on Graham Carey by Alex Neil results in a free kick. Jim Goodwin takes the free kick.48:19
Dougie Imrie takes a shot.45:01
The referee blows his whistle to start the second half.45:01 Substitution
Substitution David van Zanten is brought on as a substitute for Kenny McLean.45:00 +1:03 Half time
Half Time It is the end of the first-half.43:07
Martin Canning challenges Kenny McLean unfairly and gives away a free kick. Shot comes in from Kenny McLean from the free kick.42:18
Unfair challenge on Michael Devlin by Steven Thompson results in a free kick. Free kick taken by Kevin Cuthbert.39:53
Louis Longridge has an effort at goal from just outside the penalty box which goes wide of the left-hand post.35:23
Effort on goal by Steven Thompson from just inside the area clears the bar.33:56 Substitution
Substitution Steven Thompson joins the action as a substitute, replacing Lewis Guy.32:24
Free kick awarded for an unfair challenge on Martin Canning by Lewis Guy. Alex Neil takes the free kick.28:44
Free kick awarded for a foul by Lewis Guy on Martin Canning. Kevin Cuthbert takes the indirect free kick.26:17
Outswinging corner taken left-footed by Graham Carey from the left by-line, clearance made by Alex Neil.24:39
Unfair challenge on Kenny McLean by Alex Neil results in a free kick. Graham Carey has an effort direct from the free kick, blocked by Gary Fisher.23:42
Jon Routledge has an effort at goal from 12 yards. Save made by Craig Samson.22:43
Lewis Guy challenges Gary Fisher unfairly and gives away a free kick. Alex Neil takes the indirect free kick.21:20
Outswinging corner taken right-footed by Ali Crawford, Michael Devlin has a header from inside the six-yard box and clears the crossbar.18:29
Corner from the left by-line taken by Graham Carey, Unfair challenge on Jon Routledge by Lee Mair results in a free kick. Kevin Cuthbert takes the indirect free kick.16:21
Shot by James Keatings from outside the area goes high over the crossbar.13:17
Jon Routledge fouled by Jim Goodwin, the ref awards a free kick. Indirect free kick taken by Alex Neil.12:22
Grant Gillespie concedes a free kick for a foul on Graham Carey. The free kick is swung in left-footed by Graham Carey, clearance made by Steven Hendrie.9:48
Inswinging corner taken from the left by-line by Graham Carey, save by Kevin Cuthbert.9:16
Free kick awarded for an unfair challenge on Sam Parkin by Michael Devlin. Paul McGowan restarts play with the free kick.8:29
Free kick awarded for a foul by Jim Goodwin on Gary Fisher. Jon Routledge takes the indirect free kick.4:33
Louis Longridge produces a right-footed shot from deep inside the area which goes wide of the left-hand post.3:36
Outswinging corner taken left-footed by Graham Carey, Martin Canning makes a clearance.0:41
Kenny McLean has an effort at goal from just outside the box which goes wide of the left-hand post.0:00
The ref blows the whistle to start the match.
Live data and text provided by our data suppliers