Gayle fired a free kick narrowly over the bar as a much-changed Palace side started on the front foot, before Wilfried Zaha missed a great opportunity to open the scoring when he headed Lee Chung-yong's cross over from an unmarked position six yards out.
Fraizer Campbell's effort was then deflected over the bar by a last-ditch challenge after the striker had been teed up by Zaha as the hosts kept up the pressure, before Everton loanee Conor McAleny had Charlton's first sight of goal when he fired wide from distance.
Gayle came within inches of a spectacular opener with a ferocious 25-yard drive which flew narrowly wide, but it was the Addicks who nearly broke through shortly before half time when Karlan Ahearne-Grant's effort required a smart low save from Wayne Hennessey.
Campbell should have done better five minutes after the restart when he headed Zaha's cross wide from close range, but he made amends almost instantly when he fired home from close range after good link-up play from Gayle and Zaha.
Hennessey saved from Zakarya Bergdich with his legs as Charlton almost found an immediate response before Nick Pope saved well from Lee as both sides hunted for the important second goal of the game. It was Palace who doubled their lead on the hour when Gayle converted from the spot after Alou Diarra had brought down Campbell.
The Addicks gave themselves hope when Naby Sarr found himself unmarked to head a corner past Hennessey, who may feel that he should have done better, but the revival was shortlived.
Diarra was dismissed for a second yellow card for bundling substitute Patrick Bamford to the floor, and Gayle scored his second penalty of the night to restore the two-goal advantage.
The victory was complete four minutes from time as Gayle rose to flick a corner past Pope to complete his hat-trick and ensure his side's progression into round four.
body check tags ::