Mainz equal Bundesliga record
The victory kept Mainz top with 21 points, ahead of second-placed Borussia Dortmund, who have 15 points and take on champions Bayern Munich on Sunday.
Mainz join Bayern and Kaiserslautern as the only teams to have ever won their first seven league matches in a season.
Despite the festive atmosphere in their 20,000-seater stadium after the game, Mainz coach Thomas Tuchel said the record meant nothing to him.
"We lacked confidence in the first half and despite our early lead we looked insecure," Tuchel said.
"We improved in the second half and threatened often but Hoffenheim were tough. I never thought about the record during the game and even now it is not an issue for me," added the 37-year-old, who is the league's youngest coach.
Hamburg SV secured their first win since late August, battling from a goal down against visitors Kaiserslautern to win 2-1, with Eric Choupo-Moting grabbing the winner six minutes from time to lift his club to seventh place on 11 points.
Schalke 04's miserable season continued when they slumped to a 2-1 defeat by Nuremberg that left them 17th in the 18-team table with just four points.
Schalke had Jermaine Jones sent off in the second half for a reckless challenge on Nuremberg goalkeeper Raphael Schaefer and fell a goal behind but Dutch striker Klaas-Jan Huntelaar scored in his fourth consecutive league match to level.
The hosts snatched a deserved victory with an 84th-minute close-range effort from Andreas Wolf.
In a hugely entertaining game in Mainz, the hosts needed only two minutes to storm into the lead with Sami Allagui completing a trademark quick counter-attack launched by Lewis Holtby.
The visitors battled back and levelled just before half-time through Demba Ba but two minutes after the restart Hungarian Adam Szalai made it 2-1 and a Luiz Gustavo own goal quickly gave the hosts a two-goal cushion.
Hoffenheim substitute Gylfi Sigurdsson fired in a free-kick with his first touch of the ball in the 64th but Andre Schuerrle made sure of the three points 10 minutes later, converting a penalty after Hoffenheim defender Josip Simunic was sent off with a straight red card.
With Germany coach Joachim Low watching from the stands, Mainz put in an exciting and spirited performance that has put both Holtby and Schuerrle, who will switch to Bayer Leverkusen next season, on the brink of a national team call-up.
"Holtby's pass for their first goal was worth the money for the ticket," Loew told reporters at half-time.