The Millers took an early lead through Ryan Williams' seventh-minute strike but Craig Davies' 11th goal of the season equalised for the Latics, who were then the better team.
The visitors had a lucky escape in the third minute as Richard Wood cleared Davies' effort off the line and four minutes later the Millers were celebrating going in front.
David Ball retrieved a lost cause and after Oldham failed to clear Anthony Forde's cross, Williams lashed home.
The Latics, who are now winless in seven, grew into the game and levelled just after the half-hour when Davies curled a low free-kick into the bottom corner from 20 yards.
Richie Wellens' men were the better side after the break, but struggled for clear moments in front of goal, with Tope Odebayi wasting the best moment when he chose to pass instead of shoot from a great position in a second half that saw no shots on target.