Substitute Timo Werner scored a 56th-minute winner as RB Leipzig claimed their first win over Bayern Munich at the fifth attempt.
Bayern looked set to consolidate their status as runaway Bundesliga leaders when Sandro Wagner headed the opener with just 12 minutes on the clock.
But a stirring performance by the home side led to Naby Keita levelling just before half-time before Werner's winner ended Leipzig's luckless record against their would-be title rivals.
The home side were on the front foot almost immediately in a frantic opening exchange, with Yussuf Poulsen firing high and wide with just five minutes gone.
In what appeared to be a blow for the home side, Marcel Sabitzer was forced off injured after just 10 minutes and replaced by Werner, and Leipzig fell behind two minutes later.
James Rodriguez sent in a superb deep cross and Wagner connected firmly to head the ball back across goal and beyond home keeper Peter Gulacsi.
Bayern keeper Sven Ulreich had to make a superb double save to deny Poulsen two minutes later, and as Leipzig continued to press for a leveller, Ulreich was back in action to tip a Bruma free kick over the bar.
Niklas Sule booted a Werner effort off the line from the resulting corner, and the home side's increasingly inevitable leveller came in the 37th minute, when Konrad Laimer sent in Keita who lashed past Ulreich at the second attempt.
Keita missed another great chance on the stroke of half-time when the unmarked Werner would surely have done better, but the striker got his opportunity in the 56th minute as Leipzig grabbed the lead.
This time Keita did find his team-mate who shrugged off the attention of Mats Hummels and raced clear to fire low past Ulreich.
Bayern were not finished and Hummels almost atoned for his earlier error when he brought a fine save out of Gulacsi on the hour, before Laimer went close to extending Leipzig's lead.
The visitors' best chance of equalising came 10 minutes from time when Hummels headed over the bar from a Franck Ribery cross.
But Leipzig, who had gone into the game without a Bundesliga win in five and seemingly slipping out of European contention, were not to be denied.