The 28-year-old netted in the 53rd minute of his side's home match, heading in Dennis Aogo's corner with what proved to be the winner.
Badstuber signed a one-year deal with Bundesliga newcomers Stuttgart earlier this month after calling time on his long association with Bayern.
The move saw him re-join the club of his youth after 15 years away with Bayern, where he won five top-flight titles and the Champions League.
He has been blighted by injuries in recent seasons and spent part of last term on loan at Schalke, before his contract at the Allianz Arena expired in June.
The Mainz game was his first start since returning to Stuttgart and second appearance overall.