The Blues dominated the opening period of the match but it was Palace who took the lead, with Jefferson Lerma picking up the ball on the edge of the area and rifling the ball into the top corner in the 30th minute.
Mauricio Pochettino's side could not muster a shot until the 45th minute as Palace tried to frustrate their opponents and pick up a much-needed win to widen the five-point gap to the relegation zone.
However, it took just two minutes of the second half for the visitors to level as Malo Gusto's bouncing cross was met by Gallagher - who was on loan at Palace in 2021-22 - and he smashed the ball past Dean Henderson.
Chelsea continued to push for a winner and Gallagher secured it in stoppage time with a neat first-time finish, before Enzo Fernandez added a composed finish at the near post to help lift his side to 10th in the table.
Gallagher takes centre stage against former club
The visitors struggled to break down Palace in the first half despite dominating possession and completing 420 passes, the most in the opening 45 minutes of a Premier League game without having a shot on target since the 2003-04 season.
Pochettino's side have struggled to penetrate teams that have defended in a low block this season and found it hard to find ways through Hodgson's stubborn side.
It was Palmer who slid in a cross from wide to set up Gallagher's second, an excellent, drilled finish into the bottom corner.
The England midfielder has three goals in two games after scoring in the cup at Villa, and will hope that his first league goals of the season kickstart a run of form for him and his team.
Late goals put Hodgson future back under spotlight
Palace came into this match on the back of a damaging defeat to rivals Brighton, with manager Hodgson under increasing pressure amid inconsistent form.
The Eagles defended well in the first period and Gallagher's dragged shot wide was the only chance they had to deal with in the opening 45 minutes.
It looked as though those changes had worked after Lerma's searing 25-yard strike but conceding just 80 seconds into the second half undid all the good work.
Supporters once again held banners displaying their frustration with the club and after the late goals gave the points to Chelsea the questions about Hodgson's future will only mount.
"I can only hope that the fans are realistic. They know our injury problems and our team selection problems at the moment," Hodgson said.
"They also know there are some young players who are trying to find their way in the game. I would like to think they will take all those things into consideration.
"I don't know what people are thinking and what their attitude is going to be, but I do think that today the team gave their very best and did give the fair-minded supporter a chance to believe in this team and believe in this club as we go forward."
They remain 15th in the table and travel to Everton next Monday, before hosting Burnley.