Paul Furlong's controlled effort seven minutes from time was the reason QPR will face Cardiff in the Welsh capital for a place in division one later this month.
Furlong rode two tackles before slotting the ball over the diving keeper and into the far corner of the net.
However, only a fantastic save from Chris Day prevented Oldham taking the game into extra time.
Fitz Hall sidefooted the ball towards goal from six yards out and the QPR keeper flung himself to his right to fingertip the ball away.
Oldham knew their luck was out minutes later when top scorer Wayne Andrews was sent off for a straight red card in an off-the-ball incident by the touchline.
Before that Les Pogliacomi, returning to the team for the first time in seven weeks, brought off his own stunning stop when he flew across goal to beat out a shot from Richard Pacquette who had been left unmarked on the far post.
But in truth, the game was a frantic 100-mile an hour affair, with numerous stoppages and free-kicks.
For all that Rangers could have taken the lead in the first minute.
Kevin McLeod was left in space and had almost too much time before he fired low only to find the legs of Pogliacomi.
The Latics keeper had to be alert to hang on to another McLeod fizzer on the half hour which came to the keeper at an easy height.
Kevin Gallen went down under the tackle of Will Haining inside the box seven minutes later but it would have been harsh on the Latics if a spot kick had been awarded.
Once Oldham had weathered the storm Darren Sheridan saw his half-volley on the edge of the box deflected by a last-ditch effort by Marc Bircham which just skimmed the post to leave the visitors heartbroken.