Mainz handed Bayern Munich their first home defeat of the Bundesliga season as they claimed an excellent 2-1 victory at the Allianz Arena on Wednesday.
The visitors took an unlikely lead against the run of play midway through the first half when Jairo Samperio finished off an excellent break.
Arjen Robben eventually found an equaliser just after the hour, but Jhon Cordoba then re-established Mainz's lead four minutes from time with an excellent finish.
With second-placed Borussia Dortmund winning at Darmstadt on Wednesday, Bayern's lead at the top of the table has now been cut to five points ahead of Saturday's Der Klassiker at Signal Iduna Park.
Bayern and Mainz provided their respective starting lineups before kick-off, with Franck Ribery and Medhi Benatia both returning for the league leaders:
The hosts dominated the early exchanges with Mainz making it clear that their plan was to sit back and look to hit Bayern on the counter-attack.
Arturo Vidal almost broke the deadlock in the 13th minute with a splendid volley, but Loris Karius got down well to parry the ball away, and the German goalkeeper made another excellent stop moments later from Juan Bernat.
Mainz defended excellently in the main and took their first opportunity with aplomb when Jairo gave the visitors an unlikely lead in the 26th minute after a lightning counter-attack.
Giulio Donati received the ball wide on the right and sent a brilliant ball across the box that Yunus Malli let run for the onrushing Jairo to smash high past Manuel Neuer.
DW Sports gave some context for how surprising Mainz's opener was:
28' - Only the 6th goal Bayern have conceded at home all season. Jairo Samperio with a simple finish in the box! 0-1! #FCBM05— DW Sports (@dw_sports) March 2, 2016
Bayern were patient in their response and almost drew level just before half-time when Robben cut in from the byline and sent a left-footed shot curling just wide of the post.
Squawka provided the statistics from the opening half:
Bayern 0-1 Mainz HT:— Squawka Football (@Squawka) March 2, 2016
Chances created: 6-2
Pass accuracy: 89%-57%
Shock on the cards pic.twitter.com/PSmU9M5d9z
Pep Guardiola made no changes at the break despite his side trailing, but Mainz boss Martin Schmidt threw on Danny Latza in place of Niko Bungert.
The hosts upped the tempo at the start of the second period, but Mainz almost extended their lead six minutes in, Christian Clemens blasting high and wide after receiving a clever backheel in the box.
Bayern's first change arrived shortly afterwards as Thomas Muller replaced Kingsley Coman, and Vidal then had another long-range effort saved by Karius in the 54th minute.
Bentia headed wide from a dangerous Ribery free-kick in the 62nd minute before Robben finally found Bayern's opener from 25 yards moments later.
He received the ball from Vidal and let fly a low, hard shot that flew into the bottom corner, the excellent Karius finally beaten, per Bundesliga expert Clark Whitney:
Advantage of having a player like Robben (or 5) on the pitch: You might just get a goal out of thin air. What a strike— Clark Whitney (@Mr_Bundesliga) March 2, 2016
BT Sport Football provided footage of the goal:
The sparkling Dutchman tried another from a similar distance in the 67th minute, but this time he skied it over the bar.
Bayern pushed for the winner, but Mainz's defence held firm, and the visitors again found the net from almost nowhere when Cordoba turned home a wonderful strike from the edge of the box after Julian Baumgartlinger's neat lay-off.
Bayern searched for an equaliser and caused a few last-minute problems for Mainz as Robert Lewandowski and Vidal had half chances, but the final whistle eventually signalled the end of Bayern's perfect home record this season.