After suffering a shock 2-1 defeat at home to Lyon a fortnight ago, the Premier League champions badly needed the three points to move off the bottom of Group F.
It looked as though City would come away with only a point for their troubles until, in the 87th minute, Silva pounced on an error from Stefan Posch before firing home the precious victor.
Sergio Aguero's equaliser seven minutes later seemed to have set them back on course as they dominated most of the match but the Bundesliga side, set up in an attacking 4-3-3 mode and risky on the break, held firm until Silva cashed in on a late defensive error.
In the first meeting between the sides, the Bundesliga outfit wasted no time in forging ahead, Ishak Belfodil coolly converting following Kerem Demirbay's throughball. Ilkay Gundogan gets a start, while Leroy Sane and Raheem Sterling support Sergio Aguero.
Colorado Rockies to meet Chicago Cubs in NL Wild Card Game
Strop was under consideration to return for the win-or-go-home game against the Colorado Rockies after missing the past two weeks. Both teams lost division tiebreakers Monday, setting up Tuesday's winner-take-all Wild Card game at Wrigley Field in Chicago .
In Hoffenheim's only previous meeting with English opponents, they lost 6-3 on aggregate to Liverpool in the 2017-18 Champions League qualifying play-off round.
The second goal arrived midway through the first half, with Dybala firing home from close range after Blaise Matuidi's initial effort was saved. I'm not sure if that's down to injuries or easing players back in after the World Cup, but because they are more settled I'll say Liverpool.
"I'm very proud given the situation we're in", Hoffenheim's 31-year-old coach Julian Nagelsmann said.
Guardiola heaped praise on match-winner Silva, 32.
After seeing Lyon capitalize on City mistakes, Hoffenheim will try to force City into errors and look for Andrej Kramaric and Adam Szalai to find the back of the net. City can not afford to have one eye on their trip to Anfield on Sunday, but their squad is deep, and I expect them to get their Champions League challenge back on track.