Francois Zoko scored in injury time to seal Town’s place in the semi-finals of the Checkatrade Trophy at Fleetwood Town’s expense.
A Cian Bolger goal at either end saw the scores level at half-time before Corey Whelan’s rifled shot put the Glovers in front.
Jordy Hiwula made it all square late on, meaning a penalty shootout looked likely.
But a moment of brilliance from Zoko secured progression to the last four and a fifth win over Sky Bet League One opponents this season.
Fresh from scoring his first goal for the Glovers, Alex Fisher was granted his first Yeovil start as Darren Way made four changes to the weekend win over Cambridge United.
Rhys Browne and Corey Whelan struck up a new partnership on the right, while Jared Bird was reinstalled in central midfield.
With heavy sleet in their faces, Fleetwood were on the offensive from the off; ex-Town loanee Hiwula smashing over Bolger’s knockdown inside three minutes.
Yeovil replied through a fierce Jordan Green drive which was well gathered by Alex Cairns, seconds after Bird had been bundled over in the box – nothing given.
The game gradually warmed up on the chance front and on 17 minutes, Uwe Rosler’s visitors went ahead.
Marcus Schwabl’s deflected attempt was superbly tipped behind by Artur Krysiak but the resulting corner saw Bolger power a brilliant header past the Polish stopper.
Six minutes later, Bolger levelled the contest. Great skill from Gray forced a corner and the midfielder’s whipped delivery was helped into his own net the Cod Army’s captain.
Browne went close to adding the hosts’ second with a half-volley and Fisher hit down Cairns’ throat as the Green and Whites increased their intensity.
Bolger almost had a hat-trick of sorts, proving a nuisance by connecting with Kevin O’Connor’s corner, however the Glovers managed to clear their lines inside in the six-yard area.
The beginning of the second period was similar to the first with Fleetwood attacking from the restart.
Wes Burns reached the byeline with his electric pace, pulled back to Hiwula to strike and when his attempt was blocked, Bobby Grant curled well wide.
Cairns punched clear a trademark Tom James free kick and then out of nowhere, an unstoppable Whelan strike turned the match on its head.
Picking up the scraps 20 yards out on the angle, the Liverpool youngster sent a swerving left-footer into the bottom corner for his first professional goal.
A Hiwula poke was put behind by Krysiak soon after before a mistake from the latter allowed the former to equalise.
Town’s number one spilled Hunter’s cross and Hiwula had an empty net to tap into.
The game looked to be heading for penalties but a last-gasp stunner from Zoko kept the Wembley dream alive.
The Ivorian skipped down the right, beat his man and fired into the top corner to seal Town’s place in the last four against Shrewsbury Town.
Yeovil Town: Krysiak, Whelan, Sowunmi, N.Smith, James, Browne (Santos 84), Gray, Bird (C.Smith 90), Green, Fisher, Surridge (Zoko 61).
Not Used: Maddison, Donnellan, Dickson, Gobern.
Fleetwood Town: Cairns, Coyle, Bolger, O’Connor, Eastham, Sowerby, Grant (Hunter 71), Schwabl (Biggins 58), Burns (Dempsey 71), McAleny, Hiwula.
Bookings: McAleny 30, Sowerby 45, Schwabl 55.
Not Used: Crellin, Sheron, Donohue, Maguire.