Marcus Fraser’s late strike ended Caley Thistle’s Scottish Cup hopes with a bitterly disappointing 2-1 defeat by St Mirren in Paisley.
Neil McCann’s side, who had defeated Ross County in the third round, played their part in an absorbing Scottish Cup tie but former Staggies captain Fraser had the final say.
Both sides hit the woodwork in a frantic first half, which somehow ended without a goal.
The wait was ended three minutes into the second half with Nikolay Todorov notching his sixth goal in five games to put Caley Thistle in front.
But St Mirren equalised immediately with Kristian Dennis slamming the ball home from 18 yards after great work by Jamie McGrath.
The game looked destined for extra time before Fraser bundled home the winner with a minute to go.
St Mirren’s reward is a trip to the winners of tomorrow’s tie between Kilmarnock and Montrose in the quarter-finals.
Caley Thistle went into this tie with no shortage of confidence after an eight-game unbeaten run, which had included a 3-1 victory at rivals Ross County in the previous round.
St Mirren, by contrast, had won only once in their previous four games and were without the presence of their manager Jim Goodwin in the dugout as he served the first of two-game touchline ban for criticising referee Don Robertson.
Caley Thistle made one change from the team that drew 1-1 at Queen of the South with captain Sean Welsh returning at the expense of Roddy MacGregor, who dropped to the bench.
The Buddies, unbeaten in their last four games against Inverness, made three alterations with Kristian Dennis, Kyle McAllister and Jonathan Obika stepping in for Ethan Erhahon, Ryan Flynn and Lee Erwin.
The visitors settled quickly and had an early chance to test Jak Alnwick in the St Mirren goal when Welsh found Daniel MacKay in a promising position but the winger fluffed his lines.
St Mirren almost broke the deadlock in spectacular style when Dennis lofted a cross to the unmarked Ilkay Durmus but his overhead kick flew over the crossbar.
A slack pass from Scott Allardice across his own face of goal almost gifted the hosts the lead when Jamie McGrath intercepted but fired wide.
Sparked into life by that reprieve, Caley Thistle stormed up the other end and went close with Mackay’s low drive well saved by Alnwick.
The Buddies were looking dangerous in attack with Caley Jags stopper Mark Ridgers called into action to keep out Dennis’s powerful drive before Durmus darted in from the left wing past two defenders before firing over with his weaker right foot.
Dennis passed up an even better chance after 30 minutes when he worked a yard of space in the penalty area but his shot deflected wide off Brad Mckay.
Inverness were inches away from an opener three minutes later when Todorov showed superb strength to hold off two defenders to get a shot away on the turn but Alnwick was equal to it.
The visitors went even closer nine minutes later when Scott Allan hit the post with a curling effort from the edge of the area after great play by David Carson.
St Mirren were also denied by the woodwork as an entertaining half came to an end with Dennis’ attempt bouncing off Carson and onto the crossbar.
Caley Thistle made the perfect start to the second half when Todorov found himself unmarked to volley home Allan’s in-swinging corner kick.
But the lead lasted only two minutes with St Mirren restoring parity with a fizzing strike from Dennis which flew past Ridgers.
Saints forward Jonathan Obika had been on the periphery of proceedings but exploded into life with a thunderous attempt that had Ridgers at full-stretch.
The pressure on the visiting goal was growing with Durmus curling another effort off the crossbar and Dennis should have done better with the rebound.
On-loan Hibernian midfielder Allan went close to putting Caley Thistle in front with a low drive that drifted just past the post as play raged from end to end.
St Mirren were cursing their luck with six minutes to when Durmus’ glancing header bounced back off the post with Ridgers beaten.
But the Paisley men were not to be denied with Fraser slotting home a Brandon Mason cross from close range after Obika had hit the post.
Harsh on McCann’s side who put plenty into the game.