Leverkusen's Ballack and Kiessling react during German cup match against Dynamo Dresden
Another top-division team also went out when Werder Bremen lost 2-1 at third-division club Heidenheim.
Eren Derdiyok, Sidney Sam and Andre Schuerrle gave Leverkusen a comfortable lead in Dresden. But Dynamo, newly promoted from the third division, staged an amazing comeback against the team that finished second in the Bundesliga.
Sebastian Schuppan began the comeback in the 68th, Robert Koch then scored twice to send the match into extra time, and Alexander Schnetzler sealed the upset by scoring the winner in the 117th minute.
Markus Rosenberg scored for Werder in the 33rd, but his teammate Marko Marin had a penalty saved in the 51st and Heidenheim struck twice within two minutes, turning the game on goals from Christian Sauter in the 57th and Marc Schnatterer in the 58th.
The defeat spells more trouble for Werder, which fought against relegation last season and has financial problems that are preventing the team from acquiring players.
On Friday, Wolfsburg lost 3-2 at fourth-division club RB Leipzig.