Toni Kroos and Mario Gomez gave the hosts a two-goal cushion before Didier Konan's 74th-minute bicycle kick sparked late drama on a rainy day in Munich.
Dortmund, on 59 points, travel to Cologne on Sunday and can restore their five-point lead with a victory.
Second-placed Bayern, who left Bundesliga top scorer Gomez on the bench at the start, had a good chance in the 20th minute but Franck Ribery fired wide from 10 metres.
The Bavarians, who meet Olympique Marseille next week in the first leg of their Champions League quarter-final, went ahead in the 36th minute through Kroos.
The Germany international chipped the ball over keeper Ron-Robert Zieler after a quick combination between Ribery and Arjen Robben.
Gomez, who came on after an hour, went close when his low drive from a tight angle rattled the post.
The Germany forward was on target in the 68th minute, grabbing his 23rd league goal of the season after shaking off two defenders to curl the ball past Zieler with a fine left-footed effort.
Substitute Konan spectacularly cut the deficit for Hanover with a bicycle kick in the box in the 74th minute to trigger a nervous finale for the home team. Mame Biram Diouf then went agonisingly close to an equaliser when his header flew narrowly over.
The hosts were given another fright when Bayern defender Jerome Boateng miskicked, forcing his own keeper Manuel Neuer into a reaction save.
Bayern are chasing a treble of titles after qualifying for the German Cup final earlier this week where they will face Dortmund.