Oldham punished Yeovil's wasteful touch in front of goal as Carl Winchester fired the visitors ahead in the dying moments of the first half.
However, Town fought back after the break when Joel Grant latched onto Adam Morgan's pass to rifle the ball past Kean.
Yeovil almost took the lead on 70 minutes when Liam Shephard's free kick drifted narrowly wide of Oldham's goal.
The visitors, still without a permanent manager since Lee Johnson joined Barnsley, were forced to see out the final 11 minutes with 10 men when Brian Wilson was given a red card for a second bookable offence.
Terry Skiverton's side took advantage when Hayter, on as a second-half substitute, bundled home Grant's cross to seal a vital victory.