Lukas Jutkiewicz turned from villain to hero as dominant Birmingham beat Luton 2-1 at St Andrew's.
The Blues striker headed home the 82nd-minute winner after earlier managing one of the biggest misses of all time to make it three straight home wins for Blues.
Left-back Kristian Pedersen put Blues ahead in first-half stoppage time only for substitute Harry Cornick to level in the 67th minute, within seconds of his arrival, before Jutkiewicz's first in eight condemned the struggling Hatters to a third straight loss on the road.
Birmingham made one change from the side who beat Blackburn 1-0 on Tuesday.
Ivan Sunjic returned in central midfield after a one-match suspension and David Davis dropped to the bench.
Luton showed three alterations from Wednesday's 3-2 defeat at Fulham, as James Bree, Cornick and James Collins made way for Luke Bolton, Callum McManaman and Kazenga Lualua.
Blues went desperately close to taking the lead three times in the opening quarter of an hour.
Jutkiewicz's header was blocked by goalkeeper James Shea from point-blank range, before Dan Crowley's low first-time drive from 22 yards out flew inches wide.
Then Dan Potts's sliding tackle hit Maxime Colin to produce a dangerous shot which Shea tipped over.
Luton replied with a skidding 30-yard effort from Pelly-Ruddock Mpanzu that Lee Camp turned around a post.
But Blues returned to the attack and Jutkiewicz's 20-yard drive looped up off Martin Cranie and Shea reacted superbly to palm the ball over.
Jutkiewicz poked home from Crowley's delayed cross in the 37th minute, but it was disallowed for offside.
Five minutes later, the same combination saw the striker steer wide following a superb cross, before Fran Villalba sliced wide from 12 yards.
Pep Clotet's side finally got the goal they had been threatening in the third minute of stoppage time at the end of the first half.
Pedersen headed into an empty net after right-back Colin picked up a loose ball before exchanging passes with Crowley then crossing from the by-line.
The one-way traffic continued after the break. Kerim Mrabti's low angled drive was turned around a post by Shea.
Then came one of the most astonishing misses of all time. Mrabti did superbly to keep the ball in on the right by-line and crossed to Jutkiewicz, who somehow missed an open goal from two yards out, missing the ball completely.
His error was reminiscent of Ronny Rosenthal's open-goal miss for Liverpool at Aston Villa in September 1992, only worse.
Luton brought on Cornick for Ryan Tunnicliffe in the 66th minute and, within 60 seconds, the substitute had levelled.
Izzy Brown robbed Pedersen and found Cornick, who smashed the ball in off the crossbar, giving Camp no chance.
Jutkiewicz restored Blues' lead eight minutes from time when he nodded home from just in front of the line after Harlee Dean headed Villalba's corner back into the danger area.