Nuremburg end Bayern winning run
Brazilian-born German international Cacau, returning after having been out for around a month through injury, scored three times in a 25-minute spell in the first half.
He was also on target in the 74th minute as Stuttgart secured a morale-boosting win ahead of their midweek Champions League game against holders Barcelona. Pavel Pogrebnyak notched the other goal for Christian Gross's team.
Bayern seemed to be on course for their 14th straight win in all competitions when Thomas Mueller gave them a first-half lead in the Bavarian derby.
But Ilkay Gundogan equalised for relegation-threatened Nuremberg nine minutes after the restart.
The point was enough to take Bayern top with 49 points from 23 games although their lead could be short-lived as Bayer Leverkusen, who are one point behind, visit Werder Bremen on Sunday.
Fifth-placed Borussia Dortmund also went on a goal spree, beating struggling Hanover 96 4-1 but the other two games - Hamburg SV v Eintracht Frankfurt and Mainz v VfL Bochum - ended goalless.
Stuttgart goalkeeper Jens Lehmann made a superb save early on from Milivoje Novakovic before Cacau opened the scoring in the 13th minute, sliding in Cristian Molinaro's cross at the far post.
He then pounced on some sloppy defending to fire an unstoppable shot past Farid Mondragon in the 31st and completed his hat-trick seven minutes later when he stabbed home a loose ball after 14th-placed Cologne failed to clear a corner.
Christopher Schorch pulled one back for the hosts before the break but it was only a brief respite.
Russian Pogrebnyak headed the fourth and Cacau finished off a neat move for the fifth to take his Bundesliga goal tally for the season to six.
Bayern, who rested Franck Ribery against Nuremberg because of a bruised ankle, went ahead with their first chance, a well-worked move which ended with Mario Gomez pulling the ball back for Mueller to sidefoot home in the 38th minute.
Nuremberg replied early in the second half when goalkeeper Joerg Butt failed to hold Eric Choupo-Moting's drive. Gundogan's first effort was blocked by Philipp Lahm but the midfielder found the target at the second attempt.
Nuremberg stayed 17th in the 18-team table with 17 points, behind Hanover on goal difference.