Pep Guardiola's side went into the match having dominated this fixture in recent seasons, winning all six of the matches between the two sides since the 2021 Champions League final without conceding a goal.
It was a pattern that looked like continuing when Erling Haaland converted his spot-kick following a controversial penalty decision, after Marc Cucurella was harshly deemed to have dragged the striker down in the box.
But Chelsea did not dwell on that as Thiago Silva headed them level before Raheem Sterling scored against his former club. The Blues could not make it to half-time in front though, as Manuel Akanji netted a header of his own to equalise in first-half added-time.
It was no less entertaining after the break at Stamford Bridge, Haaland needing just 90 seconds to get on the scoresheet again as he bundled home from close range to once again give City the advantage.
Chelsea remained dangerous though and levelled it up midway through the first-half, as Conor Gallagher's effort was saved and Nicolas Jackson was on hand to turn the rebond beyond Ederson. Malo Guston had a huge opportunity to make it 4-3 to the hosts, as Sterling played him in, but he blasted over when free in the box.
Instead it was City who got their noses in front, as Rodri's strike took a huge deflection off Silva and flew into the corner with just four minutes of normal time remaining, providing the visitors with what appeared to be a dramatic winner.
But Palmer had the final say, against the club he left just a few months ago. Ruben Dias flew into a challenge and brought Armando Broja down in the box, setting the stage for Palmer to step up and lift his penalty into the top corner in the fifth minute of stoppage-time.