Leverkusen finally subdued Besiktas with two goals in the last 13 minutes to secure the 2-1 win they needed to overhaul their Turkish opponents for third place in Group B.
Along with Livorno, Racing Lens, Osasuna and Braga, the Germans became the last five of 24 qualifiers from the group stage to go into the hat for Friday's draw, which also features the eight teams finishing third in the Champions League groups.
Holders Sevilla will face one of those Champions League dropouts after Dutch side AZ Alkmaar inflicted a first home defeat on the Spanish side in European competition, ending a run of 29 unbeaten matches dating back to 1957.
AZ's 2-1 win, courtesy of Shota Arveladze's last-gasp goal, put the Dutch side top of Group C. Wins for Rangers and Tottenham Hotspur also secured group supremacy.
Leverkusen appeared to be running out of ideas against a resilient Besiktas but their luck changed when they were awarded a penalty in the 77th minute for a slight tug on Sergej Barbarez.
Keeper Vedran Runje blocked Marko Babic's spot-kick but Bernd Schneider pounced on the rebound. Barbarez tapped in a second in the 87th minute before Besiktas reduced the deficit in the first minute of added time with a Ricardinho penalty.
Spurs again turned on the style to top Group B, making it four wins from four by defeating Dinamo Bucharest 3-1 at White Hart Lane, their 10th successive win at home in all competitions.
HAYEU MISTAKE
The Premier League side dazzled with fine attacking play but it was a mistake by keeper Uladzimir Hayeu that gifted them the opener, Bulgarian striker Dimitar Berbatov seizing on a sloppy throw out to thump home his fifth goal of the tournament.
Hayeu atoned by brilliantly clawing Jermain Defoe's rasping drive on to the crossbar soon after but the England striker made no mistake five minutes before halftime, gathering Paul Robinson's goal kick just past halfway and racing through to net his first European goal.
Defoe's second followed five minutes after the break from a rapid counter attack. Dinamo's only consolation was a late strike from substitute Jean Philippe Mendy.
"It's what we wanted...to finish top of the group," Spurs manager Martin Jol told ITV. "Jermain is a goalscorer and looked ever so sharp again."
Sevilla were on course to claim top spot in Group C when Uruguayan striker Ernesto Chevanton fired home a 52nd-minute penalty but his goal was cancelled out 10 minutes later by Arveladze who beat David Cobeno with a low drive.
The Georgian then had the final say, snatching the winner for AZ in the third minute of added time.
Livorno were surprise qualifiers from Group A after Cristiano Lucarelli's goal, a header from Dario Passoni's corner, earned a 1-0 win at AJ Auxerre which eliminated the French side.
How Livorno president Aldo Spinelli will react to his side's progress is anyone's guess, having stated before the start of the group stage he hoped his team would make a swift exit as they lacked the resources for both a European and Serie A campaign.
Rangers went through as group winners, Alan Hutton's second-half header enough for a 1-0 victory over Partizan Belgrade at Ibrox.
Two goals from David Lopez in a 3-0 win at Group D winners Parma put Osasuna into the last 32. Racing Lens took third place despite losing their final game 1-0 at Heerenveen.