Jayden Stockley came off the bench to score the winner for Preston in a 2-1 victory over Luton at Deepdale.
But substitute Stockley slotted home against his former side six minutes from time to guarantee all three points and move Preston up to third in the table, while Luton sit 21st, two points above the Sky Bet Championship drop zone.
Alex Neil brought Gallagher and Darnell Fisher into the Preston team, while Graeme Jones recalled Jacob Butterfield, Callum McManaman, Luke Bolton and Kazenga LuaLua following Luton's midweek loss to Stoke.
Gallagher's penalty was blasted straight down the middle for Luton goalkeeper James Shea to block easily, but the veteran was first on the scene to tuck away the rebound.
The Hatters – behind for the 10th successive match – responded on the quarter-hour when some neat passing into the box eventually found Luke Berry who curled wide.
David Nugent rose highest to meet Fisher's well-delivered cross but should have done better with his header.
But the visitors themselves won a spot-kick when Paul Huntington brought down McManaman, with Luton top scorer Collins making no mistake two minutes before the interval for his seventh goal of the campaign.
Luton could have taken the lead with around 10 minutes to go when substitute Harry Cornick brushed off Ben Pearson to go one-on-one, but he was denied by Declan Rudd's outstretched leg, the Preston stopper also keeping out a Pelly Ruddock chance.
The Hatters were made to rue those missed opportunities when, despite defending well to keep out a flurry of shots from Gallagher and Andrew Hughes, the loose ball broke to substitute Stockley who fired home from close range.
Barkhuizen nearly set up a third once more deep into stoppage time, but Stockley curled over with the goal at his mercy.