Match ends, St. Mirren 2, Inverness CT 1.
St Mirren reached the Scottish Cup quarter-finals after Marcus Fraser's late goal gave them a hard-fought win over Inverness Caledonian Thistle.
The defender tapped in from close range with a minute remaining to knock out the Championship visitors.
Inverness led early in the second half, Nikolay Todorov slamming in a corner, before Kristian Dennis equalised almost immediately from 18 yards out.
And St Mirren struck again late on to set up a tie at Kilmarnock or Montrose.
Both sides played their part in an enthralling cup tie. Inverness crafted the best chances in the opening period, with St Mirren goalkeeper Jak Alnwick called upon to keep out Daniel Mackay, Todorov and Scott Allan.
The on-loan Hibernian midfielder's shot was tipped on to a post magnificently to prevent a first half breakthrough.
St Mirren also had a number of opportunities of their own, with efforts from Dennis, Jamie McGrath and Ilkay Durmus all going narrowly past. Dennis, in particular, was unlucky to have an effort saved by Mark Ridgers, then another brilliantly blocked by David Carson.
Neither side let up in the second period, with Inverness perhaps continuing to have the upper hand.
A series of errant passes gave Neil McCann's men a cheap corner, which they profited from in fine style. Todorov met Allan's looping ball first time to slam home a deserved opener.
That had Inverness on course to beat Scottish Premiership side, after knocking out Ross County, but St Mirren responded well. McGrath collected the ball superbly out of the air before laying off to Dennis, who unleashed an effort into the far corner.
After equalising, Jim Goodwin's men began to show their Premiership pedigree as they dominated the final half hour. Durmus was denied by the woodwork and Dennis couldn't make the most of the rebound.
The Turk was thwarted again by the upright as his glancing header bounced off the inside of the post and back into the hands of Ridgers.
Although Inverness were beginning to wilt, it looked as though extra time would be needed to settle the tie. But Fraser's late strike ensured St Mirren's place in the next round.
Obika initially did well to cannon a shot off an upright and the rebound found Brandon Mason, who crossed for Fraser to net from five yards out.
Man of the match - Marcus Fraser
What did we learn?
St Mirren will be delighted to have come out the other side of a tough draw still in the cup. They toiled at times but eventually their top-flight quality shone through.
With one of the Old Firm guaranteed to be eliminated this weekend, surely the aim for the Paisley side would be at least replicating their League Cup semi final appearance of earlier in the season?
Inverness once again showed they could mix it at this level but will rue their missed opportunities in the first half in particular. With Hearts securing the Championship title last weekend, their focus will now move to the play-offs. Given their recent form, they should find themselves in those come next month.
What did they say?
St Mirren manager Jim Goodwin: "I could stand here and talk about all the things we didn't do so well but I'd rather congratulate Inverness on their performance. Jak Alnwick was far too busy for my liking.
"I thought they were excellent, but I've got to credit my players for going right to the end."
Inverness CT interim manager Neil McCann: "It's a sore one. We're eight unbeaten going into this match, we were confident and I'm so proud of them.
"Tonight you wouldn't have been able to tell that we were a division down."
St Mirren travel to Dingwall to play Ross County on Wednesday (19:45 BST), and Inverness welcome Championship play-off rivals Dundee on Tuesday (19:00)
- 7Doyle-HayesSubstituted forTaitat 41'minutes
- 10McAllisterSubstituted forMacPhersonat 45'minutes
- 20DennisBooked at 53minsSubstituted forMasonat 75'minutes
- 24DeasBooked at 90mins
- 4WelshSubstituted forLyallat 90+1'minutes
- 77TodorovSubstituted forSutherlandat 87'minutes
- John Beaton
- Shots on Target
Second Half ends, St. Mirren 2, Inverness CT 1.
Attempt missed. Shane Sutherland (Inverness CT) right footed shot from the centre of the box misses to the right.
Foul by Ilkay Durmus (St. Mirren).
Danny Devine (Inverness CT) wins a free kick in the attacking half.
Substitution, Inverness CT. Aaron Lyall replaces Sean Welsh.
Robbie Deas (Inverness CT) is shown the yellow card.
Jonathan Obika (St. Mirren) wins a free kick in the attacking half.
Foul by Robbie Deas (Inverness CT).
Corner, Inverness CT. Conceded by Marcus Fraser.
Attempt blocked. Shane Sutherland (Inverness CT) right footed shot from the centre of the box is blocked.
Goal! St. Mirren 2, Inverness CT 1. Marcus Fraser (St. Mirren) right footed shot from very close range to the bottom right corner. Assisted by Brandon Mason.
Brandon Mason (St. Mirren) hits the left post with a left footed shot from outside the box.
Substitution, Inverness CT. Shane Sutherland replaces Nikolay Todorov.
Attempt missed. Scott Allardice (Inverness CT) right footed shot from outside the box is close, but misses to the left.
Corner, Inverness CT. Conceded by Marcus Fraser.
Brandon Mason (St. Mirren) wins a free kick on the right wing.
Foul by Miles Storey (Inverness CT).
Joe Shaughnessy (St. Mirren) wins a free kick in the attacking half.
Foul by Nikolay Todorov (Inverness CT).