Germany striker Mario Gomez scored either side of half-time against his former club after Stuttgart midfielder Christian Gentner had given Stuttgart an early lead.
The hosts were reduced to 10 men when defender Cristian Molinaro was shown a second yellow card after only 29 minutes for a foul on Bayern winger Arjen
Robben, just five minutes after he had also tackled the Dutchman from behind.
Victory puts Bayern three points clear and, with a superior goal difference advantage, they are set to finish the year as league leaders with the Bundesliga to break for winter next Sunday.
“There are still 18 games to play, the crucial thing was to win at Stuttgart, which you can never take for granted,” said Heynckes after a lively south Germany derby. “Towards the end, you could see some of my players beginning to look drained.”
“Gomez didn’t just score the two goals, he also worked really hard when we weren’t in possession,” he added. “Games against Stuttgart are very special for him. Fortunately, he scored both goals, and we really needed them.”
Bayern midfielder Thomas Müller admitted Munich had to work to take the three points.
“It was an important match, and Stuttgart are very hard work away from home,” he said. “We went a goal down but put it behind us very well. We’ve turned a game around and fought back.”
“We made trouble for ourselves towards the end because we failed to make it 3-1, and it was a very nervous finish,” he said. “You might even say we were a little fortunate, because Stuttgart had chances.”
Stuttgart coach Bruno Labbadia praised his team for their battling display despite being a man down for more than an hour. “My team put up a fantastic fight and we were very good tactically,” he said.
“We’ve not been rewarded for our courage, it’s a shame, but it wasn’t quite enough.”