Marcelo Bielsa's side raced into a two-goal lead at St Andrews thanks to goals from Helder Costa and Jack Harrison.
Leeds, who arrived on a three-match winless run, saw Jude Bellingham reduce the deficit six minutes later before Lukas Jutkiewicz levelled in the 61st minute.
Luke Ayling restored Leeds's advantage after 69 minutes, but Jeremie Bela's 83rd-minute header drew Birmingham level.
Stuart Dallas bagged Leeds' fourth goal six minutes from time, yet there was more drama to come.
The astonishing clash looked set to end all square when Jutkiewicz equalised in the first minute of stoppage-time, only for Wes Harding's own goal to win it for Leeds four minutes later.
Second placed West Brom are behind Leeds on goal difference after Middlesbrough's surprise 2-0 win at the Hawthorns.
Daniel Ayala nodded the visitors in front in the 17th minute before Ashley Fletcher sealed the points from 35 yards in second-half stoppage time.
Fulham are in third place after Bobby Decordova-Reid sealed a 1-0 win over Stoke at Craven Cottage.
Decordova-Reid broke the deadlock in the 26th minute when Jack Butland stretched to stop Anthony Knockaert's low shot from creeping in at the far post, where his team-mate was lurking for a tap-in.
Brice Samba was the hero for Nottingham Forest as Wigan were beaten 1-0 at the City Ground.
Forest keeper Samba made three vital saves, including a second-half penalty stop from Josh Windass.
Tobias Figueiredo's 60th-minute header was enough to secure three points for Sabri Lamouchi's side, who moved back into the top six.
John Swift and Lucas Joao struck early as Reading put a dent in Preston's promotion bid with a 2-0 win at Deepdale.
Defeat saw Preston slip out of the play-off places after a run of three matches without a win.
Bristol City reignited their play-off challenge with a convincing 3-0 home win over struggling Luton.
City took a fourth-minute lead through Marley Watkins and Famara Diedhiou's penalty doubled the advantage just before the break.
Andreas Weimann notched City's third in the 66th minute as Luton plunged to their eighth successive away league defeat.
Cardiff ended a run of four games without a win as they beat sixth placed Sheffield Wednesday 2-1 thanks to goals from Robert Glatzel and Junior Hoilett.