Trailing 1-0 from last month's first leg, Zenit levelled the tie when Hulk opened the scoring on the night in the 69th minute and extra time was looming when Gaitan stunned the Petrovsky Stadium by netting at the other end five minutes from the end.
Substitute Talisca wrapped up the victory with the last kick of the game as the Portuguese league leaders progressed to the last eight of the Champions League for the first time since 2012, when they also eliminated Zenit at this stage.
Avenging Ibrahimovic fires PSG past Chelsea
Benfica travelled to Russia with the edge in the tie thanks to a solitary late strike by Jonas in the first leg last month but Zenit will rue a host of missed chances in the second half at the Petrovsky Stadium as their dream of reaching the Champions League last eight for the first time died in the chill of Saint Petersburg.
Zenit's Portuguese coach Andre Villas-Boas, who will leave the club at the end of the season, has hurt Benfica in the past when in charge of Porto and he would have been confident of turning this tie around against a diminished visiting side.
The Portuguese league leaders were without a host of key players due to injury and suspension, including towering centre-back Luisao, Jardel, Lisandro Lopez, Andre Almeida and goalkeeper Julio Cesar.
Artem Dzyuba, scorer of six goals in the group stage, fired just wide for Zenit early on, but Renato Sanches came close at the other end in a fairly even first period.
Ruthless Ronaldo punishes profligate Roma
Zenit needed a goal from somewhere, but they became a much greater threat following the introductions of Igor Smolnikov and Oleg Shatov just before the hour mark.
Smolnikov should have scored from a Hulk cross moments after coming off the bench, but Ederson made a crucial save low down.
Dzyuba then should have netted after being set up by Shatov, but Benfica's resistance was broken as Zenit got the breakthrough on the night just past the midway point in the second half.
One-time Chelsea full-back Yuri Zhirkov crashed into Nelson Semedo on the left flank, leaving the Benfica player on the ground. The Hungarian referee let play go on as Zhirkov advanced into the area before lifting the ball into the six-yard box for Brazil star Hulk to head home.
That left the prospect of extra time, although Yuri Lodygin produced a superb save to keep out a header by Benfica's Swedish defender Victor Lindeloef while Ederson stood up well to deny Dzyuba after the striker had powered into the box.
Zenit looked the more likely side but Benfica got a decisive away goal from nowhere in the 85th minute. Substitute Raul Jimenez crashed a shot off the woodwork from distance and, with Lodygin taken out of the game, Gaitan followed in to score.
Talisca made it 2-1 on the night in the sixth minute of stoppage time as Rui Vitoria' side secured their place in next week's draw for the quarter-finals.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ