Mainz have been a surprise package in the Bundesliga this season and enjoy a two-point lead after nine league games, but they suffered only their second defeat of the season at the hands of Aachen.
Goals either side of half-time by Aachen's Benjamin Auer and Marco Höger put the hosts 2-0 up before Hungary striker Adam Szalai pulled one back for Mainz on 68 minutes, but the visitors left themselves with too much to do.
"We will learn the lessons from this defeat and make things better at Dortmund on Sunday," vowed Mainz manager Christian Heidel with his side set to face second-placed Dortmund in the Bundesliga's key clash on Sunday.
There was also a shock for highly-flying Dortmund as they were beaten 4-2 on penalties by third-division Kickers Offenbach after the match finished goalless following extra-time.
Elsewhere, Hamburg striker Mladen Petric claimed an unusual hat-trick as his side lost 5-2 at the hands of fellow Bundesliga side Eintracht Frankfurt after he scored for both sides.
Petric netted for Hamburg in the first-half to pull the scores back to 2-1 to Frankfurt after 23 minutes as the hosts took an early lead.
But in a bizarre turn of events he headed into his own net on 65 minutes and then scored his third goal of the game just a minute later with another header, but this time for Hamburg.
Frankfurt's Turkey striker Halil Altintop booked his side a place in the third round, to be played just before Christmas, when he converted a penalty in the 87th minute.
Fourth-division Chemnitz took Bundesliga side Stuttgart to extra time before losing 3-1, while Leverkusen were beaten 5-4 on penalties by fellow Bundesliga side Mönchengladbach.
On Tuesday, a double by German international midfield star Bastian Schweinsteiger saw holders Bayern Munich beat Werder Bremen 2-1 to reach the third round of the German Cup.
Bayern conceded an early goal when Bremen striker Claudio Pizarro scored an early goal, but the visitors defence was later exposed when Schweinsteiger equalised as France defender Mickael Silvestre put him onside.
Werder dominated the second-half but Pizarro saw a header cleared off the line and Marko Arnautovic's free kick hit the post.
Schweinsteiger scored the winner with a shot on 75 minutes from 20 metres out to give Louis van Gaal's side a boost as they are 12 points adrift of Mainz.
The third round draw, the matches to be played on December 21 and 22, will be made this weekend.