Ellis popped up six minutes from time and inflicted a fourth straight defeat on the home side, who missed a catalogue of chances.
Crewe should have taken an early lead, with Ellis and Mathias Pogba both sending free headers off target.
Oldham's Jose Baxter shot narrowly wide from distance when he tried to catch visiting goalkeeper Steve Phillips off his line, while Matt Smith also went close for the Latics.
Smith was guilty of an amazing miss after 39 minutes when Dean Furman picked him out and he sliced wide when unmarked on the six-yard line.
Phillips saved well from Baxter but it was Crewe who went in front after 61 minutes as Pogba's 20-yard blast took a deflection and flew inside the right-hand post.
Oldham levelled after 82 minutes when substitute Dan Taylor seized on a defensive mistake and drove a shot into the far corner from 12 yards out.
Yet Crewe regained the lead within two minutes, Ellis converting a close-range header from Byron Moore's left-wing cross.
- Sports & Recreation
- Jose Baxter
- Steve Phillips