City has scored late winners in each of their last four games.
The league leaders went behind to West Ham defender Angelo Ogbonna’s header before halftime.
But Pep Guardiola’s men once again rallied after the break.
Nicolas Otamendi scrambled home the leveller just before the hour mark after a barrage of pressure on West Ham keeper Adrian.
And Silva popped up with the winner seven minutes from time, the Spaniard redirecting Kevin de Bruyne’s cross into the bottom corner of the net.