Garzelli of the Acqua & Sapone team won the 16th stage with a time of 41 minutes 28 seconds on the demanding 12.9 km route in the Dolomites, an effort the watching Fernando Alonso would have been proud of.
The twice Formula One world champion and cycling fan was among the 100,000 fans roaring on the riders all day long until Spanish compatriot David Arroyo managed to cling onto his pink leader's jersey with a dogged performance as last man out.
But Basso, the 2006 Giro winner, was sixth in the time trial and knocked over a minute off Arroyo's lead as he leapfrogged Richie Porte into second spot overall.
The Giro finishes with another time trial in Verona on Sunday and Liquigas rider Basso will be battling to eat up the rest of Arroyo's 2:27 advantage having soared up the standings on Sunday when he won the challenging Monte Zoncolan stage.
Basso used Monday's rest day to recharge his batteries and was attacking the steep inclines again with his trademark gritted teeth, a sight not properly seen by fans since he returned to the race last year following a ban for attempted doping.
Garzelli produced a rampaging second half of his time trial to snatch the glory with Australian world champion Cadel Evans finishing second on the stage to lie 03:09 behind the overall leader in fourth.
"It's one of the most beautiful victories of my career," Garzelli told reporters. "I still don't believe it. Today Arroyo lost less than I expected. He is a diesel, it will be tough to take the jersey off him. There are two diffcult stages now to come, Basso and Evans will have to try everything."
This year's Giro was first dominated by crashes in the opening sections in the Netherlands before the peleton split in two after a sudden mass breakaway on the 11th stage to L'Aquila, turning the race on its head and leaving behind favourites such as Alexandre Vinokourov.
Wednesday's 17th stage is a 173-km ride from Brunico to Peio Terme which starts with a long descent before more peaks await the tired riders.
Alonso was not the only famous spectator with the Slovenia World Cup squad, training nearby, also cheering the cyclists.
(Writing by Mark Meadows; Editing by Justin Palmer
To query or comment on this story email firstname.lastname@example.org)