In the 35th minute of the match at the Etihad, and with the game at 1-1 with Palace having equalized an Ilkay Gundogan opener just a couple of minutes earlier, the away side won a corner on the left hand side of the pitch.
A free-kick won by Wilfried Zaha was lofted into the area and only half cleared by City.
But the ball fell to Townsend who, inexplicably, took the ball on the volley from 30-yards-out.
Two defeats in three games for City, who lost at Chelsea a fortnight ago, have given Juergen Klopp's Liverpool the upper hand in the title race and turned the January 3 clash between the sides at the Etihad into a real showdown.
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.
Guardiola brought on substitutes Sergio Aguero and Kevin De Bruyne and it was the Belgian midfielder who gave the home side hope with a cross-shot in the 85th minute that caught out Palace keeper Vicente Guaita.
CLIVE BRUNSKILL GETTY IMAGESManchester City lost at Etihad Stadium for the first time since April
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.
One social media user even went as far as to claim they would name their newborn baby after the player should Palace win the game.
Jamie Vardy scored as Leicester upset Chelsea at Stamford Bridge.
The English right-back failed to close down Schlupp's first half effort, and gave away the penalty for Palace's third goal with an untidy sliding challenge in the box.
Arsenal, which is fifth, drew level on points with Chelsea after Pierre-Emerick Aubameyang struck twice in a 3-1 win over Burnley at the Emirates.
West Ham's four-game winning run was ended by Watford with Troy Deeney and Gerard Deulofeu netting in a 2-0 win for the visitors.
Pyongyang won’t denuclearize ‘unless United States removes threat’
Looming over the visit are President Donald Trump's efforts to secure a second summit with Kim as soon as January. The talks will continue to limp along if the process remains murky".