Goals from Giovanni van Bronckhorst and Jonatan Johansson either side of half-time thrilled the travelling Ibrox fans.
The Leverkusen substitute Thomas Reichenberger pulled a goal back on the stroke of full-time but Rangers always looked comfortable, and must be clear favourites to progress in a fortnight.
It was hard to believe this was the side that trailed 3-0 to Shelbourne in the preliminary round. But Rangers have come a long way since August and this was their 16th match without defeat under their coach, Dick Advocaat.
The Dutchman's tactics were spot-on in the intimidating Ulrich Haberland stadium and the third-placed Bundesliga side rarely threatened. With Lorenzo Amoruso suspended, the Scotland Under-21 defender Scott Wilson made his first start of the season. He slotted in alongside Colin Hendry, captain for the night, and both players worked well together.
Leverkusen, quarter-finalists in the Champions' League last season, almost went ahead after just five minutes when Stefan Beinlich floated in a free- kick and a glancing header from Paulo Rink went narrowly wide of the target.
Rink, replacing the injured Ulf Kirsten, then got away from Hendry but the French goalkeeper, Lionel Charbonnier, got down quickly to take his shot. Rangers looked dangerous on the counter-attack and Andrei Kanchelskis went close after cutting inside.
Rink spooned a shot up in the air after Beinlich delivered the cross only for Rangers to go ahead on the stroke of half-time.
Ferguson, rated at pounds 15m by the Bayer coach, Christoph Daum, carved out the opening. Johansson then steered the ball into the path of Van Bronckhorst, who knocked it home.
Leverkusen stepped up the pressure at the start of the second half and Rink clipped the ball over the top after Beinlich, once of Aston Villa, had delivered another dangerous cross.
But Rangers hit back in the best possible way with another splendid goal in the 63rd minute. Van Bronckhorst, having his most influential game of the season for Rangers, released Rod Wallace on the right. He held the ball up and Johansson timed his run to perfection to score the second.
Leverkusen looked to have pulled a goal back in the 78th minute when Erik Meijer backheeled into the net, only for the referee Klaus Bo Larsen to rule it out for an infringement.
Hendry then cleared off the line from Reichenberger before the Leverkusen substitute grabbed a consolation goal on the stroke of full-time.
It was a slightly disappointing end for Rangers, who had been so much in control, but that could not stop the blue corner of Glasgow celebrating.
Bayer Leverkusen: Matysek, R Kovac, Happe (Reichenberger, 76), Reeb, Nowotny, Ze Roberto, Emerson (N Kovac, 58), Meijer, Rink, Beinlich, Ramelow (Heintze, 58). Substitutes not used: Vollborn (gk), Zivkovic, Lehnhoff, Mamic.
Rangers: Charbonnier, Porrini, B Ferguson, Kanchelskis, Van Bronckhorst, Albertz, Wallace (Durie, 86), Johansson (I Ferguson, 79), Wilson, Vidmar, Hendry. Substitutes not used: Niemi (gk), Amato, Petric, Stensaas, Miller.
Referee: K Bo Larsen (Denmark).Reuse content