Golden oldie Paul Furlong virtually secured QPR's Coca-Cola Championship survival with a dramatic winner and left rock-bottom Luton staring relegation in the face.
Chris Coyne and David Bell had cancelled out Dexter Blackstock's opener to put Luton on course for their first win under new boss Kevin Blackwell.
But Blackstock coolly tucked home an 80th-minute penalty and 38-year-old substitute Furlong headed a last-gasp winner to hand John Gregory's men a third straight win and almost certain Championship football next season.
Luton, who had previously taken just one point from their last seven games, were the better side in the first half but still managed to go in behind.
They went at Rangers from the off and Matthew Spring saw an early shot deflected wide.
Town should have gone ahead from the resulting corner when Spring's cross found Markus Heikkinen, but the centre-half's header flew inches past Lee Camp's left-hand post.
Rangers suffered a blow after 20 minutes when Gareth Ainsworth was forced to hobble out of the action after falling awkwardly following an aerial challenge with Coyne.
Luton had the ball in the net shortly before the half-hour mark when Spring's deep cross was met by Drew Talbot but the striker, who had two goals disallowed for offside against Southampton on Saturday, was once again thwarted by a linesman's flag.
Bell then fired in a low drive which Camp scrambled clear before Rangers finally managed a shot, Steve Lomas firing harmlessly high and wide from the edge of the area.
Rangers hit Luton with a sucker-punch four minutes before the break when the visitors failed to clear a bouncing ball in their penalty area and Blackstock calmly side-footed past Dean Brill from 15 yards out.
But Luton hit back with the last kick of the first half as Bell's cross from the right flew through a crowded penalty area and past Camp via Coyne's deft header.
Six minutes after the break Luton took the lead when Marc Nygaard inexplicably stuck out an arm to divert substitute Dean Morgan's cross.
Bell stepped up to send Camp the wrong way for his first goal since October.
Talbot was then denied by Camp at point-blank range when he prodded Calvin Andrew's cross goalwards as Luton looked for a third.
But they were pegged back 10 minutes from time when Heikkinen wrestled Furlong to the ground as both went for a high ball and Blackstock stroked home the penalty for his 13th goal of the season.
And in the final minute Furlong hurled himself at Lomas' cross to secure the victory for Rangers and leave Luton rooted to the foot of the table.
QPR (1) 3 Luton (1) 2
QPR Camp, Kanyuka (Timoska 62), Cullip, Stewart, Bignot,Bolder, Ainsworth (Smith 22), Lomas, Moore,Nygaard (Furlong 64), Blackstock.
Subs Not Used: Cole, Ricketts.
Booked: Bolder.
Goals: Blackstock 41, 81 pen, Furlong 90.
Luton Brill, Keane, Coyne, Heikkinen, Emanuel,Brkovic (Morgan 41), Spring, Robinson, Bell, Andrew,Talbot (Idrizaj 85), Morgan (Langley 67).
Subs Not Used: Foley, Perrett.
Booked: Andrew, Heikkinen.
Goals: Coyne 45, Bell 51 pen.
Att: 14,360
Ref: C Penton (Sussex).