Scotland international Garry O'Connor pulled the game out of the fire with a dramatic last minute winning goal to send Birmingham City to the top of the Championship
When it appeared the game was heading for a goalless draw, O'Connor popped up for his fourth goal of the season and his first since August 23.
A long ball from Stuart Parnaby found veteran Kevin Phillips on the left. Phillips' angled shot was parried by Julian Speroni onto the chest of O'Connor, who glanced the ball into the corner of the net.
It was a fitting end for O'Connor who had smashed two shots against the post in the first half.
The outcome came as a great relief for Birmingham manager Alex McLeish as he watched his team score only their fifth goal in six games at St Andrew's.
Palace boss Neil Warnock had every reason to be peeved as he watched his side lose at such a late stage in the game - it was also the first goal they had conceded in over seven hours.
In an attempt to bring about a change in fortunes, McLeish played with three strikers but the former Scotland boss could not have believed the bad luck experienced by O'Connor in a hectic first half.
The striker twice had to the misfortune to see powerful shots in the first half slam against the Palace woodwork.
It was one of those nights for the Birmingham side desperate to discover some goalscoring form in front of their home fans following recent disappointing performances.
Birmingham, badly hit by injuries, included the former West Bromwich Albion midfielder Nigel Quashie, who was only signed three hours before the game on a one-month loan from West Ham.
Quashie was introduced in the 73rd minute to provide more midfield flair but Palace still hung on until O'Connor's late strike.
Palace defended gamely and rode their luck on occasions but in a goalless first half gave little indication of their winning form in the last three games.
Skipper Shaun Derry was a driving force, while Danny Butterfield earned praise for some strong defending in keeping out the threat of the speedy Cameron Jerome.
The second half was another hard-fought affair with another O'Connor low drive their only real threat of breaking the deadlock until his last-minute winner.