Jonathan Burkardt and Robin Quaison scored one apiece in the first-half, while Robert Lewandowski netted a stoppage-time consolation on his return from injury for the away side.
The Bavarians were second best for much of the game as the 05ers smashed their mighty visitors off the park with an exuberant attacking display, particularly in the opening stanza.
Despite the loss, Bayern Munich remain 10 points clear at the top of the league table and could seal Meisterschale with a victory next week.
Here are the five talking points from the clash:
#1 Mainz catch Bayern Munich off guard with fast start
Mainz had been in brilliant form of late and needed just three minutes to set Bayern Munich back as a mix-up between Jerome Boateng and Alphonso Davies allowed Jonathan Burkadt to fire home an early opener.
The goal set the tone for the first half, as Die Nullfünfer continued to press high, leaving the holders on tenterhooks. The likes of Danny Latza and Danny da Costa even hit the post in the next few minutes.
The home side looked so dangerous that a second goal seemed just around the corner, and it arrived in the 37th minute. Even though Quaison scored from a set-piece, it was merely a culmination of Mainz's dominance until that point.
#2 Lewandowski returns with a whimper but salvages a late goal
Robert Lewandowski's return to Bayern Munich tonight was more of a whimper than a wham. The Pole wasted a huge chance early on and was left devoid of service for most of the match.
Having been out for the last four weeks with an injury, he was understandably below his best, lacking pace and leaving a lot to be desired with his pressing.
Yet, somehow, Lewandowski managed to find the back of the net at the death, pouncing on a defensive mistake by Mainz and coolly chipping over their goalkeeper into an empty net.
Some believe he was rushed back into the side, keeping his ambition of surpassing Gerd Muller's record in mind. If that's indeed true, then the gamble certainly paid off, even if the star had to wait till the last minute for his goal.