Leicester City 2 Cardiff City 1
Gallagher scored from the penalty spot after Richie Wellens was clumsily fouled by Haris Vuckic, and before the midfielder doubled Leicester's advantage with a fine second-half free-kick.
Peter Whittingham's penalty kick gave the visitors a lifeline, but Nigel Pearson's men held on to take an important three points, leaving the Foxes just six points outside the playoff places and ending Cardiff's nine game unbeaten streak.
Danny Drinkwater was handed his home debut by Nigel Pearson, and the former Manchester United man looked lively from the beginning, playing a dangerous ball across goal to Jermaine Beckford, but the in-form striker was unable to make contact.
Paul Gallagher volleyed wide for the Foxes after some good link-up play by Richie Wellens and Lee Peltier, while Chris Conley's bobbling shot was well-handled by Kasper Schmeichel.
Wellens then had an unorthodox overhead kick tipped away by Bluebirds' goalkeeper David Marshall, while Matt Mills' header from a free-kick flew inches wide of the far post.
Leicester continued to dominate possession in the first-half, looking more like the team in fourth place than thirteenth, with Jermaine Beckford and Paul Gallagher continuing to pepper away at the Cardiff goal.
With five minutes remaining in the first-half, Paul Konchesky hit a thunderous 25 yard volley on target, with David Marshall doing well to tip it around the post.
From the ensuing corner, Richie Wellens was untidily challenged by Cardiff's Haris Vuckic inside the penalty area, leaving referee Mark Halsey no option but to award the home side a spot kick, which was slammed home by Paul Gallagher to give Leicester a deserved half-time lead.
Leicester continued to dominate the game during the second-half, and came close to doubling their advantage when Danny Drinkwater dispossessed Peter Whittingham in midfield before finding Lloyd Dyer breaking down the left wing, whose pinpoint pass to David Nugent allowed the striker to fire across goal, but David Marshall made another excellent save to keep his side in the game.
The hosts did eventually get their second goal when Lloyd Dyer was bundled over on the edge of the Cardiff penalty area, allowing Paul Gallagher to curl a stunning free-kick over the wall from twenty yards.
The goal demonstrated the Scotsman's superb technique and ability from set pieces after a superb team counter-attack.
Substitute Rudy Gestede continued to be Cardiff's biggest threat, and won a penalty for the visitors against the run of play when Paul Konchesky was adjudged to have pushed the striker in the area following a corner kick.
Peter Whittingham made no mistake from the penalty spot, giving Malky Mackay's side a lifeline and the visiting fans something to cheer about.
As the minutes ticked away, Leicester substitute and home debutant Ben Marshall fired a long range shot over the crossbar, before playing a tempting near post ball towards Jermaine Beckford.
The hosts never looked like conceding a second goal, and the final whistle confirmed Leicester's first win in five games as their quest for a playoff spot continues.