After losing their previous three matches, a first win since the beginning of November was much needed for Eagles boss Patrick Vieira but well deserved, with James Tomkins also on target for the hosts.
Salomon Rondon pulled one back for the Toffees with 70 minutes played but Rafael Benitez’s side were largely toothless again and suffered a seventh defeat from their last nine games.
Vieira made three changes for the visit of Everton in an attempt to halt their poor run and it contributed towards a positive start for the hosts.
The recalled Odsonne Edouard created an excellent opening for Jordan Ayew after seven minutes but the Ghana international continued his barren form in front of goal by seeing his shot saved by Jordan Pickford.
Gallagher was the next to fire over from range before Wilfried Zaha tested England’s number one as Palace full debutant Will Hughes settled nicely into his role at the base of midfield.
Everton’s last trip to London two weeks ago had ended in defeat at Brentford, with boss Benitez preaching patience to a disgruntled fanbase, but Monday’s victory over Arsenal had eased some of the unrest.
It was Palace doing all the early running at Selhurst Park and they had enjoyed 77 per cent of the possession by the time their goalkeeper Vicente Guaita was called upon for the first time just after the half-hour mark.
First Demarai Gray tried his luck from outside the area before Andre Gomes volleyed straight at the Spaniard after good work by Everton’s make-shift left-back Ben Godfrey, who was again deputising for the frozen-out Lucas Digne.
Gray has been one of the shining lights for the visitors this season but it was his mistake which helped the hosts open the scoring in the 41st minute.
After seemingly surviving an attack, Everton’s Gray inexplicably under-hit his pass back to Michael Keane inside the area. Ayew was first to the loose ball and squared for Gallagher to fire home from 12 yards.
It was just reward for the hosts and they almost doubled their tally four minutes after the restart.
Zaha caused more problems down the Toffees’ right-hand side and picked out Gallagher with a cross, but the goalscorer saw his deft header go wide.
Edouard and Gallagher had further efforts before Benitez turned to his bench but his decision to withdraw Richarlison after 57 minutes raised eyebrows.
The Brazilian was far from impressed and neither were the travelling supporters, who booed the substitution before they started to chant for the Everton number seven.
It went from bad to worse for Benitez five minutes later when Palace increased their lead.
Hughes was able to grab an assist on his first start when his corner went through to Tomkins at the back post and the defender controlled before he toe-poked past Pickford from close range.
Richarlison’s replacement Rondon did give Everton a lifeline with 20 minutes to go when he slid in from close range to get off the mark after Abdoulaye Doucoure’s shot had been deflected into his path.
It lifted the away side and Joel Ward almost gifted them an equaliser with a slack pass of his own but Andros Townsend was denied a goal against his old club by a superb Jeffrey Schlupp block.
Guaita was required too in the 86th minute but blocked Anthony Gordon’s shot and Gallagher had the final say.
The Chelsea loanee won back possession and curled into the top corner from 25 yards in stoppage time for his sixth goal of the season to end Palace’s four-game run without a victory.
It lifts the Eagles up to 12th while Everton continue to struggle and are back in London on Thursday to face Benitez’s old side Chelsea.