Hearts missed out on a place in the Scottish League Cup Final - and a cash windfall - as they lost to Inverness on penalties.
It had looked like a sensational second-half double from Jamie Hamill would send Hearts through to the final in normal time, after an enthralling match at Easter Road.
But a stoppage time strike from Nick Ross took the match into extra-time at 2-2.
And when both Paul McCallum and Hamill saw their spot-kicks saved in the shoot-out, it was all the invitation Caley needed.
Ross Draper calmly slotted home the penalty which clinched it for the Highlanders, who had finished the game with just nine men on the park after the sendings-off of both Gary Warren and Josh Meekings.
Earlier, a stunning goal from Greg Tansey had given Caley the advantage before Hamill’s double turned the match on it’s head.
Hearts had hoped to have Rudi Skacel in their side but instead the former Tynecastle midfielder was sitting in the stand watching the game.
Meanwhile Ryan Stevenson started the match on the bench.
Callum Paterson was first to test the Caley defence when, with just 90 seconds on the clock, he ran from his own half to the edge of the box. However Josh Meekings persevered until he had done enough to put the Hearts striker off and won himself the free-kick in the process.
There was an even better chance at the other end just a minute later when Billy McKay carved the Hearts defence open and cut the ball into the middle of the box from the right.
Ross Draper was in exactly the right place - and the ball was perfectly weighted for him - but he somehow sliced his effort high and wide of the crossbar.
With so much at stake for the Tynecastle side, they seemed to struggle to settle into their rhythm in the early stages.
However they had a decent opportunity with 15 minutes gone when Dylan McGowan’s ball in from the right was met by the head of Dale Carrick but the youngster could only send his effort over.
Nicholson was one of Hearts’ best performers throughout and decided to go for goal himself ten minutes before the break. Caley keeper Dean Brill had to be alert to keep him out, using both hands to push his powerful long-range effort away.
The best chance of the match fell to Caley when Ross Draper picked out McKay on the right side of the box and it looked a goal all the way but Jamie MacDonald pulled off a stunning one-handed save from close range to keep him out, just a few minutes before half-time.
Stevenson came on at the break to replace David Smith as Locke tried to add to his side’s presence up front.
However Caley had started the second half the better of the two sides and they took the lead in spectacular fashion when Greg Tansey unleashed an absolutely unstoppable effort from 25 yards out.
There was so much power behind it that you almost expected it to rip a hole in the back of the net and it left MacDonald with no chance.
Hearts came close to a leveller just after the hour when Meekings and Graeme Shinnie clattered into one another outside the box, allowing Paterson to get a shot in.
The goalkeeper managed to get a touch on it but only enough to give Paterson a second bite at the cherry. This time, though, Raven was on the line to head it clear.
The game changed, though, with 65 minutes gone when Caley were reduced to ten men after Warren fouled Nicholson on the edge of the box.
And from the free-kick, Hearts levelled. It was a well-work, if slightly bizarre, goal.
Everyone expected McHattie to hammer the ball goalwards but instead he tapped it to his right where Hamill turned onto it and drilled a low shot in. It took a defelection on it’s way into the net but the Hearts fans didn’t care about that.
And within the space of just a couple of minutes, Hamill had completed an unlikely double. Again the goal came from a free kick and again it was the defender who had th beating of Brill, this time placing a stunning effort into the top right-hand corner.
Caley were dealt a blow in stoppage time when Josh Meekings was shown a straight red for a poor challenge on Robertson.
However Caley did take the game into extra-time when Nick Ross stabbed home from close range.
Just seconds into extra-time, Paul McCallum almost put Hearts back in front with a header, but Brill was equal to his attempt.
Then, with just three minutes of extra-time remaining McCallum had the chance to become an instant hit with the Hearts fans when Hamill laid it on a plate for him.
But, just a few yards out, the new boy got under the ball and could only send his header over the bar.
Neither side could bag the winner in extra-time so the match went to penalites, which were taken in front of the Caley fans in the Famous Five stand.
After both Shinnie and McCallum had seen their spot-kicks saved, Billy McKay showed them how it should be done with a perfectly-struck effort.
Dale Carrick then hit home, as did Ross and Tansey.
Although Scott Robinson was successful from 12 yards for Hearts next, it didn’t matter, as Ross Draper calmly slotted home to win the shoot-out 4-2.