The 21-year-old played his last game for the crisis-torn SPL side last week in the 1-0 win against Hearts - his 33rd appearance for the Black and Whites.
Fleming has penned a three-year deal with the Latics and will challenge the veteran shot-stopper Mark Crossley for the goalkeeper's jersey at Boundary Park next term.
The Oldham boss John Sheridan has also completed the signing of Manchester United teenager Kieran Lee on a free transfer.