Quins went into the match without skipper Chris Robshaw, winger Ugo Monye, scrum-half Danny Care and prop Joe Marler, on duty with England.
But Karl Dickson produced a tap-and-dash penalty reminiscent of Care to create a try for centre Matt Hopper, a replacement for the injured George Lowe, Monye's deputy Sam Smith grabbed an interception try and Marler's replacement Mark Lambert produced a high-impact 80-minute performance.
"I thought the lads really stepped up," said Director of Rugby O'Shea.
O'Shea was also full of praise for former England number eight Nick Easter, who skippered the side in Robshaw's absence, and full-back Mike Brown, who responded with the opening try after being released from the England training camp this weekend.
He said: "Nick is an outstanding leader and Brown reacted phenomenally in the way he played tonight. His involvement in the game was huge.
"He's absolutely outstanding in the fundamentals of full-back play, he scores tries, he takes responsibility.
"I hope he gets the opportunity to play at home in a Test match from the start over these next few weeks.
"I'm not saying anything against Ben Foden, who is a great player - injured - and Alex Goode, in outstanding form, but Mike Brown for two years has been absolutely the best full-back in the country."
But he added: "We were frustrated to give them a (losing) bonus point at the end of the game but we are not arrogant enough to think any game is easily won.
"Having beaten Gloucester, who are the form side, we are pretty happy where we are.
"They were celebrating the bonus point - we were disappointed to win. That's a pretty nice place for us to be because we want to be hard on ourselves."
Nigel Davies, the Gloucester rugby director, said: "I'm disappointed because we didn't play particularly well but I'm very proud of how well the boys fought. The spirit in this team is great."
Gloucester bounced back from the sin-binning of both Shane Monahan and England number eight Ben Morgan to salvage a point with a late try from centre Billy Twelvetrees and Davies said: "Most teams' heads would have dropped when they went down to 14 men.
"Although we lost I think we put a marker down again. We never give up and keep fighting and that's evident in this team."
But he added: "I was disappointed we didn't play enough with the ball. In fairness to Harlequins, they took their opportunities.
"The third try just before half-time was a killer. They were hit-and-run tries and we didn't react quickly enough.
"But Quins are a good team - I like the way they play. Not many teams will come here and get a result.
Gloucester skipper Mike Tindall added: "We got sucker-punched for those three tries. They were the things you get from Quins.
"We absorbed so much pressure but showed what we are about when we went down to 14 men for the second time but then produced that late try."
Gilbert has released a new line of rugby cleats. The Gilbert Virtuo 8S is part of the exciting new product. Check it out.
The Barbarians are one of the top invitational rugby sides with a long history and classic rugby jersey.
The Nike Tiempo is a solid rugby cleat and one of few styles still made from full-grain natural leather.
The Lions get ready for their matches with this green training jersey. It's what the players wear. Get in the Gear!
A cool looking all black rugby cleat with the high performance adidas is known for. Get in the Gear!
Wear the crest of the British and Irish Lions on your t-shirt. A great look for the summer.
$29.99
The Lions are ready to get their Australia tour underway. They arrive in Perth on Monday.
The New Zealand All Blacks training jersey for 2013/14. Get in the Gear!
The USA Rugby Pro Alternate rugby jersey is perfect for any fan of the Eagles. Get yours to wear during the summer Test matches.
The NEW All Blacks 2013/14 jersey has arrived at World Rugby Shop. Dare to wear the colors of the All Blacks.