Wings Niyi Adeolokun and Williams exchanged memorable first-half tries with Jack Carty's penalty edging the opening period for the visitors.
Williams' second and Rhys Patchell's snap drop-goal after the break gave the hosts a deserved win.
The tense win sent Scarlets from 11th to eighth in the table.
Pat Lam's Connacht went into the encounter propping up the table as Italian sides Treviso and Zebre picked up round-four points.
Scarlets had lost against Munster, Edinburgh and Ulster prior to facing a third Irish province in four games.
The scenario was in stark contrast to 2015-16 when Connacht ended up taking the title for the first time in their history while Scarlets finished fifth and above their three Welsh rivals.
Connacht had one saving grace in their record this season, with their third-round game against lowly Italians Zebre abandoned amid a storm and with a replay to be scheduled.
The weather in west Wales began drably and deteriorated, but at no point threatened to rival what happened in Parma the previous weekend.
However, conditions and the apprehension apparent in both teams contributed to some scrappy play.
But there were flashes of brilliance to savour.
Connacht's opening try was one of sublime creativity as the soft handling of prop Denis Buckley and hooker Tom McCartney gave wing Niyi Adeolokun just enough space to round the defence.
At the other end Wales centre Jonathan Davies and GB Olympic Sevens silver medallist brother James combined to give Williams the chance to weave his way to the line.
Patchell converted, but Carty's penalty ensured Connacht's one-point lead at the break.
It took until the final quarter for the next score.
Liam Williams had already been thwarted by last-ditch defence. Scarlets had also seen lock Jake Ball and replacement centre Scott Williams denied by narrow margins.
But after switching to full-back, Williams' wiry frame stretched beyond the clutches of Connacht's defence to touch down for his second try.
Patchell's opportunist drop-goal gave the hosts a decisive two-score lead in the 71st minute.
Scarlets: Aled Thomas; Liam Williams, Jonathan Davies, Hadleigh Parkes, Steff Evans; Rhys Patchell, Aled Davies; Wyn Jones, Ken Owens (capt), Werner Kruger, Jake Ball, David Bulbring, Aaron Shingler, James Davies, John Barclay.
Replacements: Ryan Elias, Luke Garrett, Peter Edwards, Lewis Rawlins, Morgan Allen, Jonathan Evans, Scott Williams, Will Boyde.
Connacht: Tiernan O'Halloran; Niyi Adeolokun, Bundee Aki, Eoin Griffin, Matt Healy; Jack Carty, Kieran Marmion; Denis Buckley, Tom McCartney, Finlay Bealham, Quinn Roux, Andrew Browne, Ultan Dillane, Jake Heenan, John Muldoon (capt).
Replacements: Dave Heffernan, Ronan Loughney, JP Cooney, Lewis Stevenson, Eoin McKeon, Caolin Blade, Shane O'Leary, Cian Kelleher.
Referee: George Clancy (IRFU)
Assistant referees: Keith Allen (SRU), Leighton Hodges (WRU)
Citing commissioner: Ray Wilton (WRU)
TMO: Jim Yuille (SRU)
Liam Williams scored two tries as Scarlets earned their first Pro12 win of 2016-17 to leave title-holders Connacht winless at the bottom.