Just when United’s ailments on the road were in danger of turning into a full-blown epidemic with a fifth straight loss, the visitors dug deep to somehow chisel out a victory which has booked a televised fourth-round encounter with Tottenham Hotspur on Sunday week.
It also started to erase memories of Saturday’s shocking weekend loss at Barnsley which had followed earlier poor defeats at Hull City, Nottingham Forest and Derby County.
The drama in the final 20 minutes – which saw the Blues livid at Diouf’s match-winning penalty for handball, an offence they were adamant occurred just outside the box – was as unexpected as it was welcome.
The main talking point up until then for the visiting fans who braved the cold to attend was the absence of 19-goal forward Luciano Becchio.
Pre-match talk in the Blues’ camp centred on teenage goalkeeper Jack Butland being omitted to avoid picking up a costly injury, with the financially-stricken Midlands club preparing to cash in on him to ease their strife.
While his non-appearance was confirmed, the pressing issue for the United diehards concerned Becchio with Warnock admitting to a quandary over whether to start his top-scorer after speaking about him being distracted by transfer rumours following the abysmal defeat to Oakwell.
Not only did the Argentinian not start, he was not even on the bench, with illness being given as the reason for his non-involvement at St Andrews.
All told, it was a vastly-changed United line-up, with captain Lee Peltier switched to centre-half, and Rudolph Austin, Sam Byram and Diouf the only other players who started against the Reds.
One of the replacements at the back, Adam Drury, saw his evening last just nine minutes, his luckless streak continuing as he suffered what looked like an ankle injury, Aidy White coming on in his place.
There was precious little to warm up the meagre crowd early on, with a low strike from Wade Elliott which flew wide being the nearest either side came to scoring on a pockmarked, bobbly surface.
United’s 1,547 travelling contingent in the away end saw a header from the recalled Luke Varney from Diouf’s corner just after the half-hour mark cause momentary alarm in the six-yard box before Blues hacked clear.
Soon after at the other end, Jamie Ashdown dealt comfortably with Marlon King’s low shot.
After some tame sparring, Blues conjured a breakthrough out of nothing in a rare moment of quality on 36 minutes.
A carefully-manufactured move saw King pick out Nathan Redmond, the youngster just beating the offside trap before racing clear down the right and delivering a cross which was coolly stroked home at the far post by Elliott, who had netted a cracker in the first encounter at Elland Road.
Straightaway, United spurned a golden chance to level with the unmarked Varney guiding a header wastefully off target after a fine cross from Diouf.
That was as close as United went to scoring in the first half, the gallows humour in the away end reflecting an offering which lacked inspiration and intent.
The improvement was slight, but was nonetheless there on the restart, with Austin’s low shot spilled needlessly by Butland’s replacement Colin Doyle, but no away player was there to follow up.
The Blues – whose second-half charges have been a feature of many of their games at St Andrews – seemed content to hold on to what they had.
United were grafting, but with insufficient guile to trouble the Blues’ back four until managing a decisive moment on 70 minutes.
A raid down the left unhinged the hosts with clever work from Diouf setting up McCormack, who evaded the home defence adroitly before steering the ball into the far corner past Doyle.
Six minutes later, United took the lead in controversial fashion after ex-Whites loanee Paul Robinson was penalised for handball on the edge of the area, with Andy Woolmer pointing to the spot after a long consultation with linesman Barry Holderness.
Diouf kept his cool amid the protests, chipping the ball past Doyle in effortless fashion.
Moments after coming on, substitute Peter Lovenkrands almost drew Blues level with his first touch with a low shot which was parried by Ashdown.
Blues threw on Nikola Zigic – whose four-goal haul finished off Simon Grayson’s Elland Road tenure last January – in the final 10 minutes. White was alert and cleared Zigic’s towering header off the line as the hosts sought an equaliser.
Ashdown then denied Lovenkrands, with Blues’ last chance seeing Curtis Davies head over.
Birmingham City: Doyle; Caddis, Caldwell, Davies, Robinson; Burke, Gomis, Morrison (Lovenkrands 77), Elliott; Redmond (Zigic 82), King. Unused substitutes: Townsend, Ibanez, Hancox, Hales, Higgins.
Leeds United: Ashdown; Byram, Lees, Peltier, Drury (White 10); Green, Brown, Austin, Brown, Varney; Diouf (Pearce 90), McCormack. Unused substitutes: Kenny, Tate, Norris, Somma, Hall.
Referee: A Woolmer (Northants).