Gomez brace bails out Bayern
Neckarelz, who switched the tie to Hoffenheim and were rewarded with a bumper 30,000 crowd, held the 14-times Cup winners for 50 minutes, although they were helped by Bayern's dreadful first-half finishing.
Gomez, who moved from VfB Stuttgart in May, broke the deadlock in the 51st minute with a shot which went in off both posts from Bastian Schweinsteiger's pass. His second came from a penalty awarded for handball six minutes later.
Despite having Christian Fickert sent off for a second bookable offence, the part-timers pulled one back through Heiko Throm with 10 minutes left before Hamit Altintop restored Bayern's two-goal lead and sent them into the second round.
The first round of the cup is a potential minefield for Bundesliga clubs as the seeding system pits them away to lower league teams in one-leg ties.
Hanover 96 became the second top flight side to go out when they lost 3-1 at fourth division Eintracht Trier.
Jan Rosenthal gave Hanover a halftime lead but Martin Wagner, Josef Cinar and Sierra Leoneon striker Sahr Senesie scored in the last half hour to give Trier a stunning win. Mainz were the other victims, losing 2-1 at fourth division VfL Lubeck on Friday.
Titleholders Werder Bremen had no such problems as they trounced second division Union Berlin 5-0 away with two goals apiece from Ivorian Boubacar Sanogo and Bolivian Marcelo Martins and one from Brazilian Naldo.
Martins was making his debut after joining on loan from Shakhtar Donetsk.