Dunfermline Athletic 1-3 Inverness CT
Inverness Caley Thistle came from behind to book a lucrative Scottish Cup fifth-round tie against Celtic.
But it was another error from goalkeeper Chris Smith that brought Inverness back into the game.
Andrew Barrowman headed the opener five minutes before half time.
But Smith's poor clearance gifted Jonny Tuffey a 54th-minute tap-in, substitute Shinnie fired Inverness into the lead three minutes into extra time and Greg Tansey drilled in their third.
Dunfermline had home advantage but went into the game looking for their first win this season at East End Park, having not beaten Inverness in their last eight meetings and with Smith's howler in their previous meeting fresh in their minds.
There had to be a winner this time after the three draws in three games between the sides this term, but it was perhaps little surprise that it took extra time to separate them.
Inverness were the ones to go into the game full of confidence, Saturday's 1-0 win away to Motherwell having stretched their unbeaten run to four games following a recent improvement in form that has lifted them off the bottom of the Scottish Premier League.
They have been replaced there by a Dunfermline side who lost to relegation rivals Hibernian on Saturday and whose only win in 18 games came on 5 November.
But it was the Pars who started on the front foot, with Barrowman's swift shot on the turn looping a few yards wide from 18 yards within 20 seconds.
The striker should have opened the scoring a couple of minutes later when he took David Graham's pass over the visiting defence in his stride, but his weakly struck low shot from just inside the penalty box was palmed clear by goalkeeper Jonny Tuffey.
Tuffey was given his chance with Ryan Esson suffering a strain, while Ross Tokely replaced the suspended Kenny Gillet and Richie Foran was fit to come in for Nick Ross, but most eyes were on the Northern Irishman's opposite number.
Smith was back in goal for the first time since his awful mistake handed Jonny Hayes the stoppage-time equaliser that secured Caley Thistle the replay.
With on-loan Iain Turner ineligible and Paul Gallacher injured, the obviously nervous Smith's every touch was greeted with trepidation from the home support and expectation from the visitors.
However, it took Inverness 26 minutes to test Smith and a Dunfermline defence in which Kevin Rutkiewicz was making his first appearance since August in place of John Potter.
Even then, Tansey's shot from 10 yards was blocked before it reached the goalkeeper and it was the returning central defender who helped engineer the Pars' breakthrough.
Rutkiewicz sent Joe Cardle down the left and, when the winger turned back inside his marker, his cross found Barrowman at the back post to head home from five yards.
Inverness manager Terry Butcher went for broke, bringing on Shinnie for midfielder Lee Cox at half time and the forward had an immediate impact, sending wide a drive and setting up Billy Mckay from a shot that stung Smith's fingers.
The tide was turning, but it was another Pars howler that handed Caley Thistle the equaliser when Smith tried to clear Alex Keddie's loose backheader from an innocuous punt upfield, the ball rebounded off Rutkiewicz towards his own goal and Hayes tapped into the unguarded net.
Inverness were looking the more determined, exemplified by Hayes and Foran both being booked when the team-mates clashed angrily after 74 minutes.
Smith redeemed himself slightly by turning a powerful 20-yard drive from Shinnie over the crossbar.
Dunfermline survived the pressure and Ryan Thomson, who had started ahead of the experienced Gary Mason, powered into the penalty box only for Tuffey to save the midfielder's weak effort at the second attempt.
The home side paid for that and for failing to close down Shinnie as, three minutes into extra-time, the substitute fired a drive off the inside of the far post from 18 yards.
Tansey made sure of Caley Thistle's place in the next round when he gathered a pass from fellow sub Ross and fired into the corner from just outside the box for a deserved win but one that had another Dunfermline error as its catalyst.