Mergim Berisha scored the only goal of the game as the hosts recorded their first home win of the season.
Bayern have now failed to win their last four matches in the German top flight and may drop out of the top four after Sunday’s fixtures.
Borussia Dortmund top the table after a 1-0 win over local rivals Schalke.
Substitute Youssoufa Moukoko, 17, headed the winner for Edin Terzic’s side to become the youngest player to have scored in the fixture.
Union Berlin, who currently sit second, could reclaim top spot if they beat Wolfsburg on Sunday (14:30 BST), while third-placed Freiburg travel to Hoffenheim.