City enjoyed a regal dominance up until Ilkay Gundogan's 26th-minute opener but Jeffrey Schlupp levelled six minutes later before Townsend turned the contest on its head with an outstanding long-range volley. Silva attempted to head away but the ball dropped invitingly towards Townsend around 30 yards out and he met it with a ferocious volley that flew into the roof of the net.
City had not lost any of their previous 52 league games against teams outside the traditional "big six", a run dating back almost two years to a defeat at Everton in January 2017.
Pep Guardiola summoned Sergio Aguero from the bench soon after the break, but City had a mountain to climb when Kyle Walker chopped down Max Meyer and Luka Milivojevic dispatched the resulting penalty.
De Bruyne did pull one back for the champions five minutes from time, though, picking out the top corner from his intended cross that caught out Guaita.
Gabriel Jesus missed a stoppage-time chance when he headed over a De Bruyne cross from a promising position but City were left to taste their first home league loss since the Manchester derby on April 7. The two teams meet on January 4 (NZ time). We have to try and avoid it. Football is like this - three shots on goal and three goals.
The early signs suggested that it would be another comfortable afternoon for City, who had won 10 of their last 12 Premier League matches against Palace overall and 10 in a row on home soil in all competitions ahead of this latest tussle.
New York Yankees: Machado favors Bronx, will decide after New Year
Some fans even tried to pitch Philadelphia to the four-time All-Star before the Phillies even had a chance. Then he proceeded to explain, in raised voice, why Machado should not leave without signing with the Phils.
Jamie Vardy scored as Leicester upset Chelsea at Stamford Bridge.
A key figure in City's record-breaking Premier League campaign last season and England's run to the 2018 FIFA World Cup semi-finals, Walker looked to be running on empty as he was at fault for the two avoidable Palace goals.
But it proved to be too little, too late as the hosts fell to their first home defeat of the season.
"We reacted well after the second goal but the second half we started OK, but the third goal, the penalty was really tough for us".
Defeat for the Blues allowed Arsenal to close on a top-four finish as two goals from Pierre-Emerick Aubameyang beat Burnley 3-1 in a bad-tempered clash.
Southampton won for the second successive match under new coach Ralph Hasenhuttl when it defeated Huddersfield 3-1, while Watford ended West Ham's run of four consecutive victories by winning 2-0 at the London Stadium.