Left-back Tyrell Robinson scored a 78th-minute winner as Bradford ended their run of three consecutive home league defeats by beating Rochdale 4-3.
The 20-year-old former Arsenal trainee raced on to striker Charlie Wyke's through pass before taking the ball round goalkeeper Josh Lillis three minutes after Rochdale had equalised at 3-3.
Matthew Kilgallon opened the scoring for the Bantams in the eighth minute. Tony McMahon's free-kick was headed into his path by defender Nat Knight-Percival and he fired into the corner.
Rochdale had the chance to equalise in the 13th minute when they were awarded a penalty after a foul on Oliver Rathbone but Ian Henderson's spot-kick was saved by Rouven Sattelmaier.
Both sides had chances before a dramatic end to the first half saw four goals scored in six minutes.
Wyke increased Bradford's lead in the 40th minute with a looping header off the underside of the crossbar from McMahon's free-kick.
Henderson pulled a goal back for Rochdale straight from the restart when Callum Camps' shot was deflected into his path, leaving him with only Sattelmaier to beat.
Dominic Poleon restored Bradford's two-goal advantage again straight from the restart as he turned Alex Gilliead's right wing cross in at the near post, but Rochdale scored again in stoppage time, Henderson adding his second with a close-range shot after Calvin Andrew headed the ball into his path.
Former Bradford striker Steve Davies equalised with a low shot in the 75th minute less than two minutes after coming on as substitute, but Robinson had the last word.