The Latics were in control from the start and took the lead after just five minutes through Deane Smalley. Neal Eardley charged down the right flank from his full-back position and crossed to find Smalley whose bundled shot squirmed through goalkeeper David Forde's legs.
Oldham doubled their advantage five minutes later as Kevin Maher crossed and Smalley got in to glance the ball home for his 16th of the season.
It took just nine minutes for the hosts to pull a goal back after the break when Neil Harris slotted in from the penalty spot, following Eardley's foul on Dave Martin.
And with 22 minutes to play the Lions were on level terms when Ashley Grimes cut inside from the left and curled a fine shot into the bottom corner.
Millwall looked the more likely to win the game but Latics snatched the points in injury time when Taylor leapt highest in the area to head home Maher's cross.