Going into the game on the back of five consecutive defeats, crisis side Harlequins stunned Gloucester into submission during a ferocious first quarter.
The London side scrambled over Gloucester's defence and fly-half Jeremy Staunton soon put Harlequins ahead with a fourth minute penalty.
Full-back Gavin Duffy then stretched the lead further with a try which again saw Quins shatter the home defence. Staunton converted to silence the home crowd.
But Gloucester were stung into action and what followed was a ferocious onslaught from the West Country side.
Henry Paul converted a penalty to start the fightback and England winger James Simpson-Daniel put Gloucester back in the game with a sublime touchdown.
Just moments earlier, number eight James Forrester had failed to score after he was held up at the line after a Gloucester maul, but Paul switched the run of play out wide and a spot-on long pass from Duncan McRae set up Simpson-Daniel on the left wing to score.
Paul missed the conversion, but he made amends minutes later with another superb Gloucester try, which underlined the home side's desire to pocket another league win.
McRae set up a pouncing Terry Fanolua who blasted through Harlequin's defence. The centre was brought down short of the line but Paul was on hand to finish the move. And the Kiwi then converted his own try.
But Fanolua did not have to wait long to register his first touchdown. After another quick ball from scrum-half Andy Gomarsall, the Samoan dummied Will Greenwood before side-stepping Mark Lambert to score under the posts.
Paul converted to put Gloucester 20-13 up.
Harlequins, however, were not yet ready to throw in the towel and England centre Greenwood reduced the deficit with a 48th-minute try.
His effort was soon cancelled out by the in-form Fanolua who not only stamped Gloucester's authority on the game but also secured the side's first try bonus point of the season with Gloucester's fourth score of the afternoon. Paul duly converted.
Only a last-gasp Staunton penalty prevented Harlequins from going home empty-handed, although with just three points from six matches the London side have a mountain to climb already.
For Gloucester:Tries: Simpson-Daniel, Paul, Fanolua 2Cons: Paul 3Pen: Paul
For NEC Harlequins:Tries: Duffy, GreenwoodCons: Staunton 2Pens: Staunton 3