As in the first game, Andy Barrowman put Dunfermline in front after 40 minutes before a series of defensive errors led to Caley Thistle's equaliser after 54 minutes.
Goalkeeper Chris Smith and defenders Alex Keddie and Kevin Rutkiewicz all contrived to gift a tap in to Jonny Hayes, who was later booked for a row with captain Richie Foran.
Shinnie, making his return from a calf injury, netted an unstoppable angled drive three minutes into the first period of extra time before Tansey added a third after 110 minutes to earn Inverness a home fifth-round tie with holders Celtic on the weekend of February 4 and 5.
The victory extended Inverness' unbeaten run to five games and left the Pars - now with one win in 20 - still chasing a first win at their East End Park home this season.
Dunfermline will now turn their attentions to their Clydesdale Bank Premier League survival fight at Kilmarnock on Saturday.
A third draw of the season between the Pars and Caley Thistle had forced the replay, Inverness' cup lifeline courtesy of Pars goalkeeper Smith, whose stoppage-time error allowed Hayes to cancel out Barrowman's strike in the original tie.
Smith returned to the starting line-up tonight in place of the ineligible Iain Turner, who signed on loan from Preston last week.
Smith was included as one of three changes from the side which lost 3-2 to Hibernian to see the Pars four points adrift at the foot of the SPL and his every action early on was met with cheers from a crowd which occupied the one open stand at East End Park.
The hosts should have gone ahead early on, but Barrowman's effort was saved by Jonny Tuffey after he had been played through one-on-one by David Graham.
After Andy Kirk shot on the turn at Tuffey, Tansey snatched at an effort from 10 yards after Rutkiewicz's error had played him in.
Dunfermline went ahead after Joe Cardle beat Thomas Piermayr in the left corner.
The winger cut inside and hit a right-foot cross to the back post where Barrowman headed in.
Shinnie came on at half-time for Lee Cox to make his first appearance since December 17.
He almost had an immediate impact, combining with Gregory Tade before shooting narrowly wide.
The equaliser was more about good fortune than skill as a result of further defensive calamity from the Pars.
Roman Golobart thought he had over-hit a long ball forward, Keddie headed it backwards and Smith and Rutkiewicz tangled, the ball breaking for Hayes to roll into an empty net.
The goal energised the visitors, whose emotions almost boiled over when team-mates Hayes and Foran, who had been restored as captain ahead of his compatriot, had to be separated by referee Euan Norris.
Foran appeared to be angered by a poor Hayes cross moments earlier and both men were booked.
Smith tipped over a Shinnie effort from the edge of the area moments later before Ryan Thomson had an effort saved by Tuffey at the other end.
Golobart was forced off after landing heavily in winning a free-kick and was replaced by David Proctor after a lengthy delay before extra-time ensued.
Three minutes into the first additional period Tade found Shinnie, who hit a fierce strike from an angle inside the far post.
Liam Buchanan shot straight at Tuffey as Dunfermline sought a response, but it was Inverness who struck again.
Substitute Nick Ross drifted in from the right and fed Tansey to neatly sidefoot in and seal Inverness' progress.