First Division strugglers Ayr United stunned St Mirren with a late goal in Paisley to claim a League Cup semi-final place.
Chris Smith headed in an excellent free kick from Eddie Malone on 81 minutes as the visitors grew in confidence after the interval.
St Mirren threw men forward in the closing stages and Graham Carey struck the crossbar deep into injury time.
Ayr had previously knocked Inverness and Hearts out of the competition.
And the Somerset Park club made it a hat-trick of Scottish Premier League scalps thanks to a resolute defensive display.
Saints had the bulk of territory but faded after the interval and Smith struck during a jittery period for the home side.
A late Buddies rally resulted in a few nervous moments in the Ayr penalty box but the visitors held on to the delight of their small band of followers.
St Mirren started brightly and David van Zanten was not too far away with a shot that dipped just over the crossbar.
Steven Thompson then saw an opportunity squandered when he rose highest in a packed goalmouth and nodded just over from a Kenny McLean corner.
Saints continued to pile on the pressure and an angled pass from Paul McGowan found Thomson for the header, with Cuthbert slipping before recovering to claw the effort past the upright.
McLean passed up a decent chance to open the scoring early in the second half when he met a Jim Goodwin cross and saw his header flash across the face of goal.
The game grew increasingly disjointed with basic errors creeping into St Mirren's play.
And the SPL side were left ruining missed opportunities when Ayr went in front from Smith's smart downward header.
The game finished with St Mirren laying siege to Cuthbert's goal and Carey was denied the leveller by the crossbar deep into injury time.
St Mirren manager Danny Lennon
: "It's very disappointing. It was a wonderful opportunity for us, but I must give Ayr United credit for sticking to their game-plan - certainly not the performance, but the game-plan.
"It's a sore one, but we will try to pick ourselves up very quickly.
"We certainly know that we need that cutting edge.
"That's not just been the case tonight for us, it's been over the last few weeks and maybe even from the beginning of the season."
Ayr United defender Chris Smith
: "Hearts are probably the biggest team we have beaten, but our away results have been pretty poor in the league to be honest, so this one was the best for us and it got us to Hampden as well.
"It was good to get the clean-sheet and the win.
"It was great and it's even better when you get the winning goal yourself and take your team to Hampden. There's no better feeling than that.
"In the first half, we were under pressure a bit and St Mirren had most of the possession.
"But I felt we came out in the second half and were more in control of the game.
"We had a lot of set-plays and we just had to take one of them."
Inswinging corner taken from the left by-line by Paul McGowan, Unfair challenge on Kevin Cuthbert by Steven Thompson results in a free kick. Kevin Cuthbert takes the free kick.
The ball is swung over by Paul McGowan, Header from deep inside the area by David van Zanten goes harmlessly over the crossbar.
Jon McShane takes a shot.
The ball is crossed by Paul McGowan.
Gareth Wardlaw takes a shot.
Shot from 35 yards by Marc McAusland went over the net.
The assistant referee flags for offside against Micheal McGowan. Free kick taken by Craig Samson.
Nigel Hasselbaink produces a right-footed shot from deep inside the six-yard box which goes wide of the left-hand post.
The ball is swung over by Nigel Hasselbaink, clearance made by Micheal McGowan.
Substitution Jon McShane replaces Jim Goodwin.
Micheal McGowan produces a cross, Lee Mair makes a clearance.
Nigel Hasselbaink delivers the ball.
Assist on the goal came from Edward Malone.
80:49 Goal scored
Goal! - Christopher Smith - St Mirren 0 - 1 Ayr Christopher Smith scores a headed goal from inside the box. St Mirren 0-1 Ayr.
Jim Goodwin challenges Ross Robertson unfairly and gives away a free kick. Edward Malone produces a cross,
Nigel Hasselbaink is adjudged to have handled the ball. Kevin Cuthbert restarts play with the free kick.
Jeroen Tesselaar is flagged offside by the assistant referee. Kevin Cuthbert restarts play with the free kick.
Corner taken by Graham Carey, Lee Mair has a headed effort at goal from deep inside the area missing to the left of the target.
A cross is delivered by Steven Thompson, Christopher Smith gets a block in.
Edward Malone challenges Graham Carey unfairly and gives away a free kick. Free kick crossed left-footed by Graham Carey from right wing, clearance made by Alan Trouten.
Nigel Hasselbaink takes the chance to get an effort at goal. Comfortable save by Kevin Cuthbert.
Booking Gareth Wardlaw goes into the referee's book for unsporting behaviour.
Free kick awarded for a foul by Gareth Wardlaw on Kenny McLean. Marc McAusland restarts play with the free kick.
Shot from deep inside the area by Paul McGowan clears the bar.
Paul McGowan challenges Gareth Wardlaw unfairly and gives away a free kick. Micheal McGowan delivers the ball from the free kick right-footed from left wing, clearance by Lee Mair.
Foul by Jim Goodwin on Andrew Geggan, free kick awarded. Edward Malone restarts play with the free kick.
Substitution Graham Carey is brought on as a substitute for Gary Teale.
Gary Teale crosses the ball, save made by Kevin Cuthbert.
Inswinging corner taken from the left by-line by Micheal McGowan.
Kenny McLean gives away a free kick for an unfair challenge on Jonathan Tiffoney. Free kick crossed right-footed by Micheal McGowan, clearance made by Jeroen Tesselaar.
Corner taken by Micheal McGowan, Marc McAusland manages to make a clearance.
Gareth Wardlaw delivers the ball, David van Zanten gets a block in.
Unfair challenge on Micheal McGowan by Nigel Hasselbaink results in a free kick. Kevin Cuthbert restarts play with the free kick.
The offside flag is raised against Nigel Hasselbaink. Kevin Cuthbert takes the direct free kick.
Edward Malone takes the indirect free kick.
Booking Jeroen Tesselaar booked for unsporting behaviour.
Free kick awarded for a foul by Jeroen Tesselaar on Micheal McGowan.
The assistant referee flags for offside against Nigel Hasselbaink. Kevin Cuthbert takes the free kick.
Substitution Nigel Hasselbaink comes on in place of Steven Thomson.
Corner taken by Micheal McGowan, Steven Thompson makes a clearance.
Corner taken right-footed by Micheal McGowan from the right by-line to the near post, clearance by David van Zanten.
A cross is delivered by Jonathan Tiffoney, Lee Mair gets a block in.
A cross is delivered by Edward Malone, Micheal McGowan challenges Jeroen Tesselaar unfairly and gives away a free kick. Free kick taken by Craig Samson.
Steven Thompson is flagged offside by the assistant referee. Free kick taken by Kevin Cuthbert.
Free kick awarded for an unfair challenge on Ross Robertson by Gary Teale. Kevin Cuthbert takes the indirect free kick.
Corner taken right-footed by Micheal McGowan from the left by-line, clearance made by Steven Thompson.
The ball is sent over by Jim Goodwin, Header by Kenny McLean from deep inside the penalty area misses to the left of the target.
Booking Alan Trouten receives a yellow card.
Free kick awarded for a foul by Alan Trouten on Kenny McLean. Lee Mair takes the indirect free kick.
The ball is crossed by Jeroen Tesselaar, save by Kevin Cuthbert.
Gareth Wardlaw delivers the ball.
Steven Thomson sends in a cross.
Free kick awarded for a foul by Micheal McGowan on Paul McGowan. Jim Goodwin takes the free kick.
The referee gets the second half started.
45:00 +1:12 Half time
Half Time The referee blows for half time.
David van Zanten delivers the ball, clearance made by Andrew Geggan.
The assistant referee signals for offside against Paul McGowan. Kevin Cuthbert takes the free kick.
A cross is delivered by Kenny McLean.
Unfair challenge on Paul McGowan by Jonathan Tiffoney results in a free kick. Free kick crossed right-footed by Gary Teale, save by Kevin Cuthbert.
Gareth Wardlaw challenges Marc McAusland unfairly and gives away a free kick. Indirect free kick taken by Jim Goodwin.
Jeroen Tesselaar produces a cross, Steven Thompson takes a shot. Save by Kevin Cuthbert.
Short corner taken by Gary Teale.
The ball is delivered by Paul McGowan, Chance falls to Steven Thomson who heads at goal, save by Kevin Cuthbert.
Handball decision goes against Alan Trouten. Indirect free kick taken by Gary Teale.
Corner taken by Gary Teale from the left by-line, Steven Thompson has a header from inside the six-yard box and clears the crossbar.
Jeroen Tesselaar sends in a cross, blocked by Jonathan Tiffoney.
A cross is delivered by Jeroen Tesselaar, Christopher Smith makes a clearance.
A cross is delivered by Jeroen Tesselaar, Kevin Cuthbert makes a save.
Steven Thomson challenges Andrew Geggan unfairly and gives away a free kick. Indirect free kick taken by Christopher Smith.
Effort on goal by Kenny McLean from long distance goes over the crossbar.
Outswinging corner taken by Micheal McGowan from the right by-line.
Gareth Wardlaw fouled by Jim Goodwin, the ref awards a free kick. Edward Malone restarts play with the free kick.
The referee penalises Kenny McLean for handball. Direct free kick taken by Kevin Cuthbert.
Gary Teale takes the inswinging corner, Marc McAusland concedes a free kick for a foul on John Robertson. Free kick taken by Kevin Cuthbert.
The ball is sent over by Steven Thompson, blocked by Jonathan Tiffoney.
The ball is delivered by David van Zanten, clearance by Christopher Smith.
Christopher Smith challenges Steven Thompson unfairly and gives away a free kick. The free kick is delivered right-footed by Gary Teale from right wing, Steven Thompson concedes a free kick for a foul on Christopher Smith. Kevin Cuthbert takes the indirect free kick.
Inswinging corner taken right-footed by Micheal McGowan, Steven Thompson manages to make a clearance.
Centre by Gareth Wardlaw, Jeroen Tesselaar manages to make a clearance.
The ball is delivered by Gary Teale, save made by Kevin Cuthbert.
The ball is delivered by Gary Teale.
Foul by Jonathan Tiffoney on Paul McGowan, free kick awarded. Indirect free kick taken by Jim Goodwin.
Effort from just outside the area by David van Zanten goes over the bar.
Gary Teale takes the free kick.
Booking Ross Robertson booked for unsporting behaviour.
Free kick awarded for a foul by Ross Robertson on Steven Thomson.
Free kick awarded for a foul by Micheal McGowan on Paul McGowan. Indirect free kick taken by Paul McGowan.
A cross is delivered by Kenny McLean, Ross Robertson makes a clearance.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.