Jordan Roberts picked the perfect time to net his first Inverness goal as the winger's spectacular injury-time strike sent the holders past Motherwell and into the quarter-finals of the William Hill Scottish Cup.
Stephen McManus had put through his own net from Carl Tremarco's 39th-minute cross before helping Motherwell level midway through the second half when his header set up Scott McDonald from a well-worked corner.
But Roberts secured a 2-1 victory when he ran at the Motherwell defence and made space to hit a left-footed shot into the top corner from 25 yards.
The winger has yet to make his first start for Inverness after missing most of the season with a groin problem but he introduced himself in spectacular fashion.
Kieran Kennedy came in as Ben Hall missed out with a hamstring injury for Motherwell and manager Mark McGhee matched Caley Thistle's five-man midfield by handing Morgaro Gomis his first start in place of top goalscorer Louis Moult.
The first shot on target came from Greg Tansey, the subject of much controversy during the week following Aberdeen's failed bid, but Connor Ripley saved his free-kick.
Ripley might also have got a slight touch on Tremarco's header, which looped on to the bar.
A tight game opened up for Motherwell when Chris Cadden rode a challenge following an Inverness corner and embarked on a break that should have led to better than an offside flag following his pass to McDonald.
McDonald then headed against the bar following an excellent cross from Marvin Johnson but the opener came courtesy of Tremarco's alertness as he pounced on a loose ball just inside the Motherwell box.
Home right-back Josh Law misjudged the run of the ball and pulled out at the last minute for fear of giving away a penalty, allowing the visiting left-back to get to the bye-line and drive the ball back into the six-yard box. His cross got past Ripley and went in off McManus after Miles Storey failed to make contact.
Cadden and McDonald, twice, had ambitious efforts saved and the former set up Stephen Pearson with an inch-perfect cross, but the midfielder missed his kick.
Inverness began to threaten on the break with Danny Williams and Storey failing to make the most of decent chances before the pair linked up with the former forcing a close-range stop from Ripley.
The home fans began to shout for Moult and Lionel Ainsworth before a section told McGhee: "You don't know what you're doing."
As Moult prepared to come on, Motherwell reasserted themselves as an attacking force after Cadden's forward run led to a free-kick. Johnson had a shot deflected wide after the delivery and Motherwell levelled from the resulting corner. McManus ran from deep to meet Steven Hammell's cross on the edge of the box and McDonald diverted his header home.
Moult initially stayed in the dugout as Inverness got back on top before being brought on for Keith Lasley with seven minutes left. But it was another substitute who stole the show as Motherwell lost a costly late goal for a third consecutive game.
Why are you making commenting on The Herald only available to subscribers?
It should have been a safe space for informed debate, somewhere for readers to discuss issues around the biggest stories of the day, but all too often the below the line comments on most websites have become bogged down by off-topic discussions and abuse.
heraldscotland.com is tackling this problem by allowing only subscribers to comment.
We are doing this to improve the experience for our loyal readers and we believe it will reduce the ability of trolls and troublemakers, who occasionally find their way onto our site, to abuse our journalists and readers. We also hope it will help the comments section fulfil its promise as a part of Scotland's conversation with itself.
We are lucky at The Herald. We are read by an informed, educated readership who can add their knowledge and insights to our stories.
That is invaluable.
We are making the subscriber-only change to support our valued readers, who tell us they don't want the site cluttered up with irrelevant comments, untruths and abuse.
In the past, the journalist’s job was to collect and distribute information to the audience. Technology means that readers can shape a discussion. We look forward to hearing from you on heraldscotland.com
Comments & Moderation
Readers’ comments: You are personally liable for the content of any comments you upload to this website, so please act responsibly. We do not pre-moderate or monitor readers’ comments appearing on our websites, but we do post-moderate in response to complaints we receive or otherwise when a potential problem comes to our attention. You can make a complaint by using the ‘report this post’ link . We may then apply our discretion under the user terms to amend or delete comments.
Post moderation is undertaken full-time 9am-6pm on weekdays, and on a part-time basis outwith those hours.
Read the rules here