Germany forward Gnabry joined Bayern from Werder Bremen last June before being sent on loan to Hoffenheim and he won and missed a penalty – with Mark Uth netting from Sven Ulrich's save – before spectacularly giving the visitors a two-goal lead after just 12 minutes at the Allianz Arena.
Robert Lewandowski's 18th Bundesliga goal of the season reduced the arrears and Jerome Boateng ensured it was all square inside a breathless opening half hour.
Bayern took a firm grip on the contest from that point and quickfire second-half goals from Kingsley Coman and Arturo Vidal sealed the points before Sandro Wagner scrambled a fifth in the final minute to rub salt into the wounds of his former employers
Jupp Heynckes' side are a dominant 16 points clear at the summit, while counterpart Julian Nagelsmann – who enjoyed a mixed outing in terms of an audition for the top job at Bayern – and Hoffenheim lie ninth.
Seriously Serge?— FC Bayern English (@FCBayernEN) January 27, 2018
It's 2-0 to Hoffenheim. (12') #FCBTSG
The visitors flew out of the blocks and raced into a two-goal lead, although there was the consolation for Bayern that they appear to have made an incredibly shrewd investment.
Joshua Kimmich gave referee Manuel Grafe little option but to point to the spot when he clumsily bundled into the back of Gnabry, whose penalty similarly left much to be desired but Uth was on hand to dispatch the rebound.
Where he struggled from 12 yards, Gnabry then excelled from twice the distance, netting with a clattering right-footed drive after Boateng's interception from Lukas Rupp fell kindly.
Bayern's emergence from their slumber was as sudden as it was impressive, with Coman leading Hoffenheim wing-back Pavel Kaderabek a merry dance before crossing for Corentin Tolisso to touch into Kimmich's path. The full-back's effort from the edge of the box was not cleanly struck but Lewandowski got a telling touch to nutmeg goalkeeper Oliver Baumann.
It was 2-2 in the 25th minute when Boateng was allowed ample room to convert Arjen Robben's corner.
The champions remained firmly in the ascendancy until the interval - David Alaba hooking a shot narrowly wide and Lewandowski blasting over on the angle at the end of a solo run - but Hoffenheim were able to remain on terms.
Baumann flapped unconvincingly at an Alaba cross to give Nagelsmann a fright after the restart, although the goalkeeper's efforts in getting behind a spectacular long-range volley from Vidal were far more impressive.
Hoffenheim were offering more as an attacking force than they did during the closing stages of the first half, only for Bayern to hit the front after 63 minutes.
Ex-Hoffenheim man Sebastian Rudy and Lewandowski worked the ball swiftly through midfield for Coman to collect the ball in the area, cut in side and sweep a shot beyond Baumann.
Poor set-piece defending allowed Bayern to make the points safe, even though there was plenty to admire in the precision of Vidal's looping header back across goal as technology confirmed the ball had crossed the line.
Revenge for a 2-0 defeat at Hoffenheim was assured and January signing Wagner was the latest man with ties to both clubs to make a mark on the contest, smuggling home to open his Bayern account after fellow substitutes Rafinha and Thomas Muller combined to create the opening.
Key Opta stats:
- Mark Uth is the first player since Edin Dzeko and Grafite in 2008-09 to score three goals in a Bundesliga season against Bayern Munich.
- Robert Lewandowski has scored in each of Bayern's 10 home Bundesliga matches this season, extending the club record. The overall Bundesliga record is held by his coach Jupp Heynckes (11 for Gladbach).
- Jerome Boateng has scored the first Bundesliga goal in 1540 days, his previous strike coming back in November 2013 in a 3-0 win over Augsburg.
- Heynckes has won his 150th Bundesliga match as Bayern coach. Only Udo Lattek (184) and Ottmar Hitzfeld (158) have won more for the club.