In the day's other match, Jefferson Farfan ran more than half the length of the pitch to score a late goal and give Schalke 04 a 1-0 win at Bayer Leverkusen.
Hanover took the lead with a Mohammed Abdellaoue penalty in the 23rd minute, the first time ever-present Bayern goalkeeper Manuel Neuer had been beaten in 761 minutes.
Christian Pander added to their troubles when he scored with a deflected shot five minutes after the restart.
Substitute David Alaba pulled one back for Bayern with seven minutes to go.
The Bavarians still lead the way with 22 points from 10 games, three ahead of Borussia Dortmund who demolished Cologne 5-0 on Saturday.
Schalke are third on 18 points, ahead of Hannover on goal difference.
Bayern had kept eight successive clean sheets in the league since their 1-0 defeat by Borussia Monchengladbach on the opening day.
Abdellaoue nearly ended that run in the 12th minute when he hit the post, while Mario Gomez had a close-range header superbly saved by Ron-Robert Zieler and Toni Kroos rattled the bar for Bayern.
Bayern finally cracked when Philipp Lahm fouled Steve Cherundolo and Abdellaoue converted the penalty for his seventh league goal of the season.
That left Neuer 123 minutes short of the Bundesliga record of 884 minutes set by VfB Stuttgart's Timo Hildebrand.
It got worse for Bayern five minutes later when a late challenge by Rafinha sparked a melee on the touchline and Boateng was given a straight red card.
Hannover increased their lead when Pander's speculative shot took a wicked deflection off Luiz Gustavo and left Neuer helpless.
Cherundolo was sent off for a second bookable offence just after the hour and Hannover suddenly found themselves under pressure.
Substitute Alaba pulled one back when he beat his marker to Lahm's crossfield pass and nipped the ball past Zieler and Bastian Schweinsteiger struck the post.
Peru forward Farfan celebrated his 100th Bundesliga appearance with a stunning goal which started with a Leverkusen corner.
Farfan won the ball off Andreas Schuerrle and sprinted away from two chasing players, ending a 60-metre run by slotting the ball past Bernd Leno.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.