Ryan Lowe scored an injury-time penalty to seal victory for Tranmere at Oldham.
Referee Eddie Ilderton blew his whistle for a spot-kick on 94 minutes when he deemed that Oldham goalkeeper Mark Oxley had fouled Lowe.
Latics boss Lee Johnson was sent to the stands for his protests as the striker buried the winner.
The hosts created numerous chances and could have led inside two minutes, but Johnson Clarke-Harris headed off target from James Dayton's cross.
Adam Rooney, James Tarkowski and Albert Rusnak also went close, as Oldham had a penalty appeal of their own waved away when Tarkowski seemed to be dragged down by Ian Goodison.
Tranmere's only chance before Lowe struck from 12 yards came eight minutes before time as Ash Taylor headed wide.