Dortmund had not lost at home since early March, and beat Leverkusen 2-1 away on Saturday in the Bundesliga,
However, they were undone by hesitant defending that allowed the 20-year-old Maza to score in the 34th minute in their round of 16 tie.
Leverkusen had the ball in the home goal a second time in the 62nd minute, but Martin Terrier's side-footed effort was ruled out for offside after a VAR review.
Nevertheless, they held on to move into the quarter-finals.
Leverkusen are joined in the last eight by RB Leipzig after they overcame conceding an early penalty to FC Magdeburg to post a comfortable 3-1 home victory.
Supporters kept silent at both matches for the first 12 minutes as they continue to protest proposed changes to security measures around German football matches.
Christoph Baumgartner scored twice for Leipzig.
Earlier on Tuesday, Louis Oppie squeezed in a low shot seven minutes from time to hand St Pauli a 2-1 away win over Borussia Moenchengladbach in their cup tie.
In the clash of second-tier clubs, Hertha Berlin's 16-year-old Kennet Eichhorn became the youngest scorer in post-war German Cup history as he contributed the third goal in a 6-1 thumping of Kaiserslautern.
