Oldham pulled off one of the surprises of the season in division two thanks to a brave fightback led by goals from Ernest Cooksey and John Eyre.
And the victory helped them forget about losing manager Iain Dowie who walked out on Friday to join Crystal Palace.
Dowie was replaced on a caretaker basis by midfield veterans David Eyres and John Sheridan and they made the perfect start against leaders QPR.
Oldham secured their first win for over two months to leave Rangers boss Ian Holloway furious with his team.
Ian Holloway blasted: "We were like Jekyll and Hyde and you cant afford to be like that. Credit to Oldham but we were poor in the second half and too many players let themselves down.
"We had problems with injury and illness this week which meant we could only name four subs but it is no excuse for not being solid." Oldham decided to use Eyres in their starting line up but he saw his new charges make a slow start as Rangers dominated the first half.
And the visitors went ahead on 31 minutes as Gareth Ainsworth beat the offside trap down the right and his cross gave Tony Thorpe a simple finish three yards out.
Latics wasted a big chance through Jermaine Johnson but his opposite number Kevin Gallen was even more guilty when his shot was saved by Leslie Pogliacomi before he fired wide from another inviting chance.
Oldham began their comeback after 67 minutes when Cooksey charged in at the far post to power home a corner from six yards.
Cooksey had a bust up with Rangers midfielder Marcus Bean but was soon smiling again when Oldham grabbed the winner after 86 minutes.
Ex QPR man Paul Murray saw his shot beaten out by Chris Day but Eyre was on hand to tuck in the rebound from six yards.