The fly-half landed a late penalty from nearly 40 metres to give his side the win against their regional rivals.
With just a minute remaining, Llandovery were ahead 26-23 and seemingly in control but when Kieran Murphy was yellow carded, two late Williams penalties saw his side snatch the spoils.
Llanelli team Manager Anthony Buchanan said: “Both sides put on a fine display of adventurous rugby and as a region we should be proud of the way our Premiership clubs are playing. Both sides approached the game the right way and the entertainment was first class.”
Llandovery coach Lyndon Lewis on the other hand was extremely disappointed at the result.
“I won’t say we deserved to win but we certainly did not deserve to lose and if we had taken two gilt-edged chances in the second half we would have sneaked it,” he said
“We are still in with a shout of a play-off spot but need to win our next two games – at home to Cross Keys on Friday and away to Bridgend on March 23 to keep in touch.”
Both halves were fiercely contested but Llanelli had the boost of an early 7-0 lead when wing Kristian Phillips profited from hesitant tackling to slice through the middle. The Drovers responded though with a penalty from fly-half James Garland and a converted try from full back Chris Knight.
From the restart, home wing Kyle Evans snatched the ball in mid-air and with Williams adding the conversion and two penalties to one from Garland, it was 20-13 to Llanelli at the break.
With home prop Aled Hopkins sin-binned, Llandovery raced into 23-20 lead through a Garland penalty and a converted try from Knight.
The fly halves swapped penalties and just after another Llanelli prop – Shaun Hopkins – was yellow-carded, a brilliant Roberts break was only foiled by a cover tackle from Evans on Lee Rees.
Llandovery looked to be hanging on but with No. 8 Murphy sin-binned, Williams tied the scores with a penalty off the upright.
That looked to be that but Llandovery lost their own ball at a scrum, were penalised on the floor and up stepped Williams to put over the vital kick for a personal tally of 19 points.
Llanelli: : Tries: K. Phillips, K. Evans. Cons: J. Williams (2). Pens: J. Williams (5).
Llandovery : Tries: C. Knight (2). Cons: J. Garland (2). Pens: J. Garland (4).