Substitute Paul Dalglish grabbed an extra-time winner to send Livingston into the CIS Insurance Cup semi-finals.
Craig Dargo fired Inverness into the lead from close range and Allan Walker cleared another effort from the striker off the line before Livi levelled.
Dave Mackay fired home from the edge of the area against the run of play.
Dalglish rounded the keeper to put Livi ahead after a Ramon Pereira through ball before Caley Thistle's Ian Black struck the post in the dying seconds.
Ludovic Roy had been given his debut in place of the injured Roddy McKenzie.
But the former Ayr United goalkeeper was beaten before a minute had gone.
Harold Pinxten failed to clear Ross Tokely's cross and Dargo was left with the easiest of tasks to stroke the ball into the empty net from a couple of yards out.
Inverness player-boss Craig Brewster had dropped himself from the squad despite Saturday's 2-1 win over Dunfermline, with Graham Bayne coming in to partner Dargo in attack.
It looked like the strategy was working, with Livi looking rattled and Roy forced into action again to hold a 25-yard drive from Barry Wilson.
The French goalkeeper then somehow clawed the ball back before it trundled over the line after David Proctor's shot deflected off Livi defender Paul Tierney.
Another mix-up in the Livi penalty area following a Wilson corner allowed Dargo a shot on goal from 12 yards, only for midfielder Walker to hook the ball clear.
But the home side levelled with their first serious effort on goal a minute from the break.
Inverness failed to clear and, when the ball fell to Mackay at the edge of the penalty area, the former Dundee player drove his shot past goalkeeper Mark Brown.
Buoyant Livi should have gone ahead when James McPake found some space but snatched at his shot from eight yards just after the break.
A tremendous 30-yard free-kick from Wilson had Roy using both hands to guide the ball safely over the bar at the other end.
Richard Hastings' fine cross found Bayne, but the Inverness striker's disappointing effort from 12 yards out went wide.
Extra-time was needed and it was Livingston, without a league win, but who provided the shock of the last round when they beat Hearts who again prevailed thanks to a Dalglish goal that the visitors claimed was offside.
Livingston: Roy, Mackay, Pinxten, Strong, Brittain, Walker, Neil Barrett (Dorado 119), Snodgrass (Dalglish 89), McPake (Pereira 67), Dair, Tierney.
Subs Not Used: Scott, Woods.
Goals: Mackay 44, Dalglish 117.
Inverness CT: Brown, Dods, Munro, Hastings, Tokely, Proctor, Duncan, Black, Bayne (McAllister 109), Wilson (Morgan 76), Dargo (Wyness 98).
Subs Not Used: Hart, Fraser.
Booked: Munro, Black.
Goal: Dargo 1.
Ref: M McCurry