Birmingham were denied victory at the death as Lewis Grabban's 98th-minute penalty rescued a 1-1 draw for Nottingham Forest at St Andrew's.
Marc Roberts' 49th-minute header looked to have secured a third straight Championship win for the first time since February 2020 and put them close to avoiding relegation with three games to play.
But Grabban scored from the spot after Lukas Jutkiewicz was judged to have shoulder charged Scott McKenna as he sent a header at goalkeeper Neil Etheridge.
The draw left Blues 10 points clear of third from bottom Rotherham, who have five matches left.
They have taken 14 points from seven games under head coach Lee Bowyer and Grabban's reply ended a run of 460 minutes since they last conceded.
Forest – managed by former Blues boss Chris Hughton – ended a run of no points and no goals in three outings.
Birmingham had the first chance when the unmarked Scott Hogan could only glance across goal from Kristian Pedersen's cross.
That was the last that was seen of Hogan after he was forced off in the 19th minute.
The former Aston Villa striker has recently been struggling with a hip problem and walked off holding his lower back, replaced by Jonathan Leko.
The home side threatened again just before the break, but Jutkiewicz sent a bullet header straight at goalkeeper Brice Samba from Ivan Sanchez's inswinging corner.
Out of the blue, Forest went close in the 42nd minute when Luke Freeman crossed from the right and Ryan Yates glanced against the crossbar.
Blues returned to the attack from the restart and took a deserved lead.
It was no surprise it came via another headed set-piece as Roberts stole in unmarked at the far post to head home Sanchez's inswinging corner.
The centre-back got to the ball ahead of team-mate Pedersen to score his fourth goal of the season.
Forest had a rare chance when James Garner let fly from 25 yards and his low, skidding drive bounced just wide.
Roberts almost went from hero to villain when he left Etheridge short with a header from Samba's long kick to let in Lyle Taylor, who was injured in a collision with the Blues goalkeeper as the latter smothered well.
But it was Blues who continued to make the running as Roberts' header from Jeremie Bela's corner was pushed away by Samba and Jutkiewicz volleyed wide from the rebound.
Blues missed the chance to make it 2-0 when substitute Riley McGree's shot on the turn was blocked by Samba's legs.
Then came the late penalty drama as Forest rescued a late point.