Bath United's Richard Lane scored a 78th minute match winning try to reduce Harlequins to their first loss of the Aviva 'A' League.
Despite the defeat, the Londoners have secured a semi-final in the competition and have topped the southern conference on points difference ahead of Saracens Storm.
Harlequins lead 3-20 at half time thanks to a brace of tries from Jordan Burns and ten points from Ben Botica's boot. However Bath's second half come back, lead by the impact of replacement Ollie Devoto, allowed the home side to score four tries to Quins' one.
It was a bitterly cold night at the Recreation ground and as the game progressed, the temperatures plummeted. Scrums, rucks and mauls developed behind the misty curtain from the players' breath and at times the cold and slippery conditions forced numerous handling errors.
The visitors raced into an early lead with a try from scrum-half Burns. Tom Guest picked from the base of the first scrum and ran down the blindside from his own 22. Up against Tom Dunn at blindside flanker, a regular prop, the inexperienced back-row allowed the number 8 to make good ground. Guest shipped to Charlie Walker and after running to halfway, he offloaded to Burns who ran under the posts to score.
Bath then had a wealth of possession and could only put points on the board through Tom Heathcote's boot after 17 minutes.
Despite the cold and damp conditions, Harlequins played a very quick and open style regularly opting for quick line outs which kept the Bath defence guessing.
Former Bath hooker, Dave Ward was key in scores from Quins in the latter stages of the first half. Initially, Ward turned the ball over during a Bath attack and after a couple of phases he broke free of the line and brought Quins into the 22 with a powerful run. Bath infringed and Botica extended the lead to 3-13.
Just two minutes later, with half time approaching, Burns crossed for his second try in a phase of play which again resulted directly from a turnover.
Joe Trayfoot broke the initial line of defence on halfway and passed to Jack Clifford, with the defence closing in, the ball found speedster Burns who scored under the posts, giving Botica an easy conversion and a 3-20 lead for Harlequins.
In the early stages of the second half, it was the hosts who capitalised on turn over ball. Half time replacement, Devoto made a storming run into the Harlequins half to start the move and after working their way to the line, Olly Parkinson crossed. Heathcote's conversion reduced the gap to ten points.
Eleven minutes later, after a promising Harlequins attack was shut out by the Bath defence, Devoto crossed for a try. Olly Woodburn made a break from 40 yards out and when he passed to the replacement, he scored after slipping tackles from Ollie Lindsay-Hague and Charlie Walker. Heathcote added the conversion but was unable to draw the scores level at 20-20 with a penalty on the hour mark.
On two occasions, Heathcote's ill-discipline let him down. Harlequins were able to kick to touch on 66 minutes and set up a driving maul, when the ball was shipped wide, Walker was bundled to touch and after stealing the resulting lineout, Quins attacked again.
Will Collier bundled over the line, but was held up and a five metre scrum was set. From the set piece, a free kick was awarded and choosing not to reset, replacement Henry Taylor decided to tap and go. The ball found Rory Clegg who's attempt at a drop goal was charged down. Bath cleared their lines and gained possession when Walker knocked on trying to collect the clearance.
With Bath in possession Devoto again made his mark. Breaking the Harlequins line on the left hand side he shipped the ball wide for Jack Cuthbert to score. With the conversion Bath lead for the first time at 24-20.
Immediately, Harlequins responded. Gaining possession from the restart, Clegg produced an inside pass to allow Louis Grimoldby through the line. The fly-half, who was playing in the centres offloaded to Harry Allen who was brought down inches from the line. As the forwards powered the line, Collier drove his way over the whitewash. Grimoldby added the extras giving Harlequins a 24-27 lead with six minutes left.
The hosts worked their way into the Quins half and Ward was penalised in the 22. Heathcote had the chance to level the scores, but his kick faded just short of the crossbar and after a couple of phases Clegg cleared his line up to the 22.
This allowed Bath to attack again and from the set piece the ball was shipped wide to the left hand side. Woodburn made a break along the touchline and was brought down just before the line. The ball was shipped wide and found the opposite winger Lane to score in the corner. The conversion was missed, and Bath held on for a 29-27 win.