Substitute Gareth Evans struck Bradford's winner five minutes into added time against Stockport's nine men as Peter Taylor's reign ended in a 3-2 victory.
Bradford took a 14th-minute lead when Steve Williams rose to head Michael Flynn's free-kick over former Bantams keeper Matt Glennon.
However, Stockport equalised in the 27th minute as Williams lost possession to Paul Turnbull who shot through a gaping gap to score.
Stockport winger Adam Griffin was sent off for handling Kevin Ellison's shot in the 34th minute but Glennon saved James Hanson's resultant penalty.
And Ryan Dobie put the visitors in front on 40 minutes, Lenny Pidgeley diving at the striker's feet but failing to hold on to the ball.
However, Dobie was sent off for elbowing Luke Oliver in the 65th minute, Williams headed his second goal ten minutes later and Evans' late angled drive snatched the points.