Pavel Pogrebnyak grabbed the winner for Reading as they twice came back from a goal down to beat QPR in the third round of the Capital One Cup.
Junior Hoilett finished a solo run with a shot into the bottom corner to put the hosts ahead before Kaspars Gorkss headed in a leveller.
Djibril Cisse's powerful shot put QPR back in front only for Nicky Shorey's free-kick to haul Reading level again.
Pogrebnyak flicked in a winner and even had a penalty saved as Reading won.
QPR keeper Julio Cesar kept out the injury-time spot-kick, awarded when Stephane Mbia fouled Pogrebnyak, but there was too little time left for the home side to make the most of it as the visitors held on to book their place in the last 16.
The two sides went into the match in the bottom two places in the Premier League and with just one win - from the last round of the Capital One Cup - from their outings so far this season.
QPR boss Mark Hughes made four changes, including giving summer signing Mbia his debut and Kieron Dyer his first start for 13 months.
Midfielder Dyer, like the home side, made a lively start as QPR quickly seized the upper hand.
They were rewarded for their early play when Hoilett struck with a lovely solo goal as he left several defenders in his slipstream before firing a low shot past keeper Alex McCarthy.
However, QPR barely had time to settle against a Reading side who had made seven changes, including giving Jimmy Kebe his first start of the season after his recovery from a hamstring injury.
Shorey swung in a free-kick which was met with a firm header by Gorkss, who did not celebrate scoring against his former club.
Both sides had chances either side of half-time as Kebe had a shot blocked, while QPR midfielder Jamie Mackie had an effort saved by McCarthy.
The game swung from end-to-end and it was the peripheral Cisse who eventually made his presence felt with a stunning strike which gave McCarthy no chance.
Reading again hit back almost immediately when Shorey's 25-yard free-kick went in off the underside of the crossbar.
The visiting side were eventually rewarded for their refusal to be shrugged off when Jay Tabb cut the ball back for Noel Hunt, who fed Russian Pogrebnyak to produce a deft finish for Reading's third.
Pogrebnyak was not made to pay for his stoppage time penalty miss as the Royals progressed to a home tie against Arsenal in the next round.
QPR manager Mark Hughes: "To lose it in the manner we did is disappointing but it is understandable to a certain extent given the changes and the injuries we have at the back.
"We haven't had that continuity at the back, which you need to bang results out.
"It is difficult at the moment because we're playing guys at different levels of fitness and we're trying to get everyone up to speed. That will come but we're just not there at the moment."
Reading manager Brian McDermott: "Our identity as a team is what you saw, what we're about, and I know if we perform at that level and that tempo with the way we pass the ball with pace then we are going to be more than capable in this league. No problem.
"I felt we needed to strip the team back to what we're about, really. In the last couple of games our tempo has been slow and we haven't been getting crosses into the box or creating too many chances.
"We really stripped the side back. We had good conversations in the dressing room and we wanted to get a result and we did that."