The tall striker seized on a loose ball after the visitors failed to clear James Meredith's cross and lashed the ball into the net with a right foot shot to crown a stirring comeback after City had gone behind in the second minute.
Tom Bradshaw scored with a close-range header for the visitors when Ryan Woods' cross from the right was headed back into the goalmouth by Adam Reach from just beyond the far post.
Bradford suffered another blow when they lost leading scorer Nahki Wells after 23 minutes with an ankle injury after a heavy challenge from defender Dave Winfield.
But they responded well before half time when skipper Gary Jones and substitute Mark Yeates had goal-bound shots blocked in a frantic spell of pressure and goalkeeper Chris Weale made a superb save from Kyel Reid.
Reid equalised in the 60th minute from Yeates' cross and the match appeared to be heading for a draw before Hanson's last-gasp winner.