The tomato industry and buffalo farming generate waste, including sludge (BS) and tomato pomace (TP), which can significantly impact their economic and environmental sustainability. The case study tracked changes in microflora composition after a thermal shock during anaerobic co-digestion. The inoculum-to-substrate ratio was 0.5 based on volatile solid content under mesophilic conditions. An Automatic Methane Potential Test System was used to monitor the process before and after thermal stress (50°C) occurred for three days. Next-generation sequencing analyzed the bacterial and archaeal communities. The pH decreased, and methane production plateaued due to the high volatile solid content (87 g/L). After thermal stress, the pH returned to neutral, and the batch resumed biogas production. The cumulative CH4 production reached 3,115 Nml. The biogas had a maximum methane peak of 78.5% compared to 58.4% in BS. The taxonomic classification showed that Firmicutes (51.7%) and Bacteroidetes (29.9%) represented 81.6% of the total OTUs among the bacteria. Fonticella, the most abundant Clostridiaceae (average 4.3%), was absent in BS and increased (up to 17.1%) in TP during methane production. Methanocorpusculum was the most abundant in the archaeal community. However, Metanosarcina showed a stronger correlation with methane production. Brief thermal stress significantly altered bacterial and archaeal populations and allowed to resume biogas production.