Andrew Higgins signalled his return from injury with the decisive try after 65 minutes as Bath rallied from 10-3 down and kept Harlequins scoreless for nearly an hour.
Simon Keogh's try had earned Harlequins the lead after 22 minutes but Bath winger Keiron Lewitt came off the bench and scored with his first touch in Premiership rugby to make it 10-8 at the interval.
Chris Malone's drop goal then gave Bath a narrow advantage before Lee Best fed Higgins down the right and Harlequins were condemned to their fourth successive defeat of the season.
Worcester may remain narrow favourites for the drop this year, but unless Harlequins can stop the rot it is a fate that might yet befall them.
The landmark nature of the match aside it was an unremarkable contest, though no doubt a fixture Lewitt and Higgins will remember for some time to come.
Bath began the game with purpose, running hard and straight – a tactic assisted by Harlequins policy of testing Best under the high ball, trying to make the most of the damp, difficult conditions.
It was Malone's teasing chip into the corner that put Harlequins under pressure in the opening minute as the ball nestled just in-field and forced Keogh to run into a wall of chasing defenders.
After some slick handling through the backs, Bath moved ahead with a fifth-minute penalty from Barkley.
Jeremy Staunton replied in kind three minutes later after Bath were caught on the wrong side of the ruck and as both sides relied heavily on the boot, it was unsurprising the first try came from a turnover.
Bath flanker Michael Lipman popped the ball up from the deck and Tony Diprose snatched the interception, fed the ball out via Andy Reay to Keogh 40 metres out.
After a neat kick and chase, the Irish winger dived on the ball and Staunton's conversion opened Harlequins a 10-3 lead.
Barkley was struggling with the boot and missed consecutive penalties before Bath hit Harlequins with a swift counter-attack, finished off magnificently by debutant Lewitt.
The England Under-19 international had only just arrived on the field as a replacement for Alex Crockett when he was fed the ball wide on the left and he stood up Harlequins full-back Gavin Duffy and beat him on the outside.
Barkley missed a third kick and Bath, frustrated at trailing 10-8 as they headed down the tunnel for half-time, emerged a more powerful force up front and almost scored a second try.
After Rob Fidler stole a line-out, Bath were decamped in the Harlequins 22 and although the hosts defended valiantly and eventually forced the turnover, Feaunati charged down the clearance and Lipman touched down.
Harlequins were saved by the television official, who adjudged the ball had been knocked forward, but Malone clipped over a 35-metre drop-goal to earn Bath an 11-10 lead.
Bath then kept Harlequins at bay with some determined defence of their own – a last-ditch tackle stopping Staunton just short of the line – before extending their advantage to 18-10.
Lipman fed Best who spun the ball wide and Higgins celebrated his recovery from ankle ligament damage by scooting in down the right for a victory that was preserved by some stout defence to deny Harlequins what might yet prove a vital bonus point.
For NEC Harlequins:Try: Keogh Con: Staunton Pen: Staunton
For Bath Rugby:Tries: Higgins, LewittCon: Barkley Pen: Barkley DG: Malone