QPR sit bottom of the Premier League with two defeats from as many games but were expected to make light work of their lowly opponents.
Yet Adam McGurk scored a spectacular free kick in the 77th minute to compound their poor start to the season.
Romain Vincelot was Leyton Orient's hero as he rose highest to head home Bradley Pritchard's cross in the 87th minute.
Jordi Gomez, Adam Johnson and Connor Wickham scored late goals as Sunderland battled past a dogged Birmingham City to reach the third round with a 3-0 victory.
Jon Walters scored twice and Peter Crouch added a late header as Premier League Stoke City eased past fourth-tier Portsmouth 3-0 at the Britannia Stadium.
Struggling second-tier club Leeds United lost 2-1 against local rivals Bradford City, who ended a run of 14 matches without a win against their Yorkshire neighbours dating back to 1986.