They trailed 2-0 to the Blues with 17 minutes left, Clayton Donaldson netting twice after shots had proved too hot to handle for Anders Lindegaard and his half-time replacement Chris Kirkland.
Alan Browne started the fight back with a powerful close-range finish from a Tom Clarke cross in the 73rd minute.
Then with the clock having ticked into the 89th minute, Greg Cunningham slammed home after both he and Bailey Wright had hit the woodwork.
Although it is now four games without a win for the Lilywhites, the late rally showed their battling qualities.
It looked like the game had got beyond them, Donaldson netting in the 13th minute after Diego Fabbrini's shot had been pushed out by Lindegaard.
The big striker did likewise just before the hour mark, sweeping the ball into the roof of the net when David Cotterill's free-kick was parried by half-time substitute Kirkland.
Then came the comeback which happened in front of the 538 Preston supporters who had journeyed down the M6.
Clarke, Browne and Joe Garner had returned to the starting XI after being on the bench for Saturday's draw with MK Dons.
They replaced Paul Huntington, Daniel Johnson and Beckford as Grayson sought to freshen things up.
North End endured a difficult opening spell, Paul Gallagher booked inside the first three minutes for pulling back Fabbrini.
It was the recalled Fabbrini who caused plenty of problems early on, a strong run from him only ended by Clarke's well-timed sliding tackle on the edge of the box.
The Italian played a big part in Birmingham's 13th minute opener, working his way to the edge of the box and hitting a low shot which Lindegaard could only parry.
Donaldson was first to the rebound, knocking it into the net from six yards.
North End started to come into the game, Garner going close three minutes after the goal.
His initial shot hit team-mate Eoin Doyle but fell back into his path, the striker letting fly a second time and seeing the ball travel inches past the post.
Marnick Vermijl limped off in the 20th minute after getting a knock on the ankle, Huntington replacing him.
The switch saw Clarke move to Vermijl's right-back slot, Huntington going alongside Bailey Wright in the centre of defence.
Gallagher struck a low shot wide after keeper Tomasz Kuszczak's punched clearance from Clarke's cross had fallen to him.
North End were denied by an equaliser by a fine Kuszczak save just beyond the half-hour mark.
A floated cross from Gallagher found Doyle at the back post, his header superbly tipped behind by the keeper.
When the resulting corner was cleared out of the box, Ben Pearson had a shy at goal with a first-time shot which went just over.
At the other end, Jacques Maghoma's shot struck Clarke and went behind for a corner.
The Blues protested that it had hit Clarke's arm but he was stood at close quarters and would not have been able to get out of the way.
In the run-up to the interval, Adam Reach was not far off target with a shot from 20 yards, a smart half-turn having created some space.
In the 45th minute, another Kuszczak save once again kept Preston at bay as they pressed.
Clarke's cross from the right was won in the air by Garner who headed it down into the path of the inrushing Browne.
The Irishman struck a fierce first-time shot which the keeper dived to push out before grabbing at the second attempt.
North End were forced into a change of keepers at the break, Lindegaard replaced by Chris Kirkland.
He was beaten in the 59th minute in a similar way to how Lindegaard was for the first goal.
The build-up to the goal started with PNE on the attack but when the ball came back to Wright, he was pressed by Cotterill and Donaldson and lost possession.
Wright brought down Donaldson, earning a yellow card and giving away a free-kick 25 yards out.
Cotterill's free-kick beat the wall and was parried by Kirkland, once again Donaldson the first to the rebound and scooping a shot into the roof of the net.
Huntington, who stayed in the box after a set-piece, came close to halving the deficit in the 63rd minute.
The centre-half met a Gallagher cross, his header back across goal tipped behind by Kuszczak.
North End did finally haul themselves back into the contest with 73 minutes on the clock.
Gallagher sprayed a wonderful pass from the middle of the pitch out to Clarke who got to the byline on the right.
The skipper put a cross with plenty of pace on it into the box, Browne timing his run well to meet it six yards out and steer into the net.
Just after the goal, another Cotterill free-kick had Kirkland scrambling across goal but fortunately it dropped wide.
The goal gave Preston some impetus and as the game entered its last 10 minutes, they were very much on the front foot.
Their pressure paid off when they equalised in the 89th minute at the end of a game of pinball in the Blues box.
Gallagher delivered a corner from the right into the box, Cunningham trying his luck with an overhead kick which hit the post.
Huntington played it back to Gallagher who lifted a cross over to the back post where Wright headed against the woodwork.
As it came down, Cunningham made no mistake with a powerful shot from six yards.
If anyone was going to win it from there, it was North End but a third goal was to elude them as four minutes of stoppage-time was played out without incident.
Birmingham: Kuszczak, Caddis, Morrison, Shotton, Grounds, Davis, Kieftenbeld (Gleeson 39), Cotterill, Fabbrini (Lafferty 76), Maghoma, Donaldson. Subs (not used): Robinson, Vaughan, Solomon-Otabor, Spector, Legzdins.
PNE: Lindegaard (Kirkland 46), Vermijl (Huntington 20), Clarke, Wright, Cunningham, Gallagher, Browne, Pearson, Reach, Doyle (Beckford 72), Garner. Subs (not used): Johnson, Welsh, Hugill, Robinson.
Referee: Keith Stroud (Hampshire)
Attendance: 14,366 (538 PNE)