The Bavarians emerged narrow victors thanks to the midfielder's 75th goal but they didn't have it all their own way on Saturday afternoon
In avoiding defeat, Pep Guardiola's side stretched their unbeaten league run to 36 matches, equalling the record set by Hamburg between January 1982 and January 1983.
Niklas Sule gave the hosts the lead in the 34th minute following a mistake from Manuel Neuer.
However, Bayern equalised in fortuitous fashion five minutes later when Franck Ribery's free-kick was deflected in by Mario Mandzukic for his eighth league goal of the season and Thomas Muller netted the winner 15 minutes from time.
The victory means Bayern climb back to the top of the table and set a new club record for their longest unbeaten start to a Bundesliga season, surpassing the old mark of 10 matches set at the start of the 1968-69 campaign.
Hoffenheim made one change from last week's win at Hannover, as Kevin Volland replaced Eugen Polanski, while Dante and Javi Martinez returned for Bayern after respective ankle and groin injuries.
After a quiet opening to proceedings, Philipp Lahm and Muller were both denied by Hoffenheim goalkeeper Koen Casteels within the space of two minutes.
Lahm was kept out at the near post from the tightest of angles in the 15th minute before the Belgian flung himself to his left to parry Muller's powerful drive from the edge of the area.
The visitors began to dominate possession and Mario Mandzukic diverted the ball wide from David Alaba's cut-back.
Muller and Martinez then got in each other's way while attempting to convert a Bastian Schweinsteiger free-kick, with the ball trickling wide after rebounding off the latter's thigh.
Despite Bayern's dominance, the hosts took the lead following a mistake from Neuer.
The Germany international made a mess of what appeared to be a routine catch from Kai Herdling's left-wing corner and Sule made no mistake when presented with an empty net from six yards.
Hoffenheim’s lead did not last long as Ribery's free-kick from 20 yards took a wicked deflection off Mandzukic and wrong-footed Casteels on its way into the bottom left-hand corner.
But the homeside went close through Volland twice at the start of the seond half, after he firstly volleyed over Sebastian Rudy's deep cross before seeing a 20-yard effort parried wide by Neuer.
Muller then scored what proved to be the winner from close range after being set up by Ribery's quick turn and pass.
The Bayern forward then wasted a golden chance to add a third four minutes from time when he somehow headed Schweinsteiger's cross wide from six yards, but it mattered little as Bayern held on to extend their incredible unbeaten run.