They had the advantage of a first-half wind at their backs, but a late try to Quins centre Emyr Jones meant his side turned only 11-14 down at halftime.
The sides entered the final 10 minutes locked at 17-all and not for the first time this season, Newport fly-half Griffiths kept his nerve to slot the winning goal.
Neath kept in touch with Newport with a 35-12 victory at bottom-placed Ebbw Vale, with their cause being helped by two penalty tries.
Cardiff gained a 25-5 victory at home to Cross Keys with prop Martyn Madden
making his debut as a replacement; third-placed Aberavon defeated an
out-of-form Pontypool 26-8 with the Division’s leading scorer Jamie Davies
scoring 11 points to take his season tally to 226.
Caerphilly came back from 7-13 to pip Swansea 17-16, complete the double and overtake them in the table.
Llanelli’s hopes of climbing out of the bottom four weren’t helped by an 18-30
loss to Bedwas at Stradey Park, while Pontypridd’s solid season continued
with a 27-21 victory at Llandovery.