The Bantams responded from a late equaliser from 10 man Accrington to snatch an even later winner via the head of Alan Connell.
Garry Thompson's neat strike in the first half had given City the lead but Romuald Boco equalised following Dean Winnard's dismissal for a second bookable offence. The win closes the gap at the top of the table and leaves The Bantams only 3 points off the top 3 and 6 points from league leaders Gillingham.
City almost went ahead early on following a bout of head tennis in Accrington's area. The ball bounced around and eventually fell to Will Atkinson who powered a header narrowly wide of the target.
A long ball forward was knocked down by James Hanson and Zavon Hines hit a shot towards goal that was held by Paul Rachubka after the sting was taken out of the shot by a block from Peter Murphy.
Zavon Hines was looking lively and he cut inside unchallenged before teeing up Gary Jones who hit a first time drive with the outside of his boot a yard or so wide of the target.
After early pressure The Bantams took the lead on 24 minutes; Rory McArdle's floated freekick was knocked down by James Hanson and the ball sat up for Garry Thompson to fire home a powerful shot into the bottom corner.
Stanley's defending was looking far from convincing and after failing to clear their lines the ball came out to Nathan Doyle who hammered a firm shot over the bar from 20 yards.
City were far from their best during the game and when Accrington upped their intensity early in the second half, chances started to be presented to them.
Four minutes into the second period Romuald Boco missed a gilt-edged chance of bringing his side back into the game. Craig Lindfield's cross picked him out at the far post and he stooped to head narrowly wide of the target when perhaps he should've at least tested Matt Duke.
Matt Duke was firmly tested a few minutes later; James Beattie's clever quick freekick found Lindfield in the area and he curled a shot that looked to be nestling into the far corner but Duke appeared at full stretch to tip the ball round the post.
With just over 20 minutes of the game remaining Stanley's Dean Winnard was given his marching orders by referee Geoff Eltringham for his second bookable offence following a poorly timed challenge on Nahki Wells.
Garry Thompson came inches away from his second goal soon after when he cut inside from the right to hit a fierce shot from 25 yards that fizzed narrowly over the bar.
With 10 minutes remaining Accrington equalised. A hopeful freekick into the area was not dealt with quick enough and the ball eventually fell to Romuald Boco who smashed the ball through a crowd from close range.
James Hanson was close to scoring soon after when he headed Gary Jones' corner marginally over the bar but City did take the lead once more 5 minutes later.
Alan Connell led a counter attack to find fellow substitute Kyel Reid on the left flank, Reid delivered an inch perfect cross to the near post which was headed home by Connell to hand City all three points and secure his second late winner in as many home league games.