Oldham clung on to their place in Coca Cola League One after a dramatic final day of the season.
The Latics needed all three points against Bradford and they pulled off the feat with goals from Chris Killen and Luke Beckett - relegating Torquay in the process.
It was a close-fought game at Boundary Park as Bradford pushed hard for 90 minutes and in the end were unlucky to suffer only their second away defeat in five months.
Oldham keeper Leslie Pogliacomi denied the Bantams time and time again in an inspired performance.
Oldham grabbed the lead only after three minutes thanks to link-up play between Beckett and Killen. Beckett got behind defender David Wetherall down the left wing and his cross was headed in by Killen from six yards.
Oldham went close to a second when Bradford keeper Donovan Ricketts sent out a wayward throw which hit Kevin Betsy and dropped to Neil Kilkenny 25 yards out but his shot cannoned back off the bar.
The visitors pulled level on 10 minutes after a controversial free-kick was taken for a second time from the edge of the box following a hand ball.
Dean Windass sent his shot into the bottom right-hand corner for his 27 league goal of the season which meant he ended as the division's joint top marksman alongside Hull City's Stuart Elliott.
Pogliacomi made two fine saves from Andy Cooke and Oldham capitalised by regaining the lead midway through the first half.
Killen's through ball saw Beckett dash clear and he rounded the keeper before coolly slotting in from close range.
Bradford refused to lie down and Pogliacomi kept out Marc Bridge-Wilkinson and Ben Muirhead as his side survived a nervous second half.