Man-of-the-match Williams scored the opening try of the game after a sublime break and a second score from all-action back Ellis Jenkins saw the home side open up a 14-0 lead by the break.
Edinburgh responded in the second period and with the swirling windy conditions now favouring them a try from marauding wing Tim Visser looked to spark a comeback.
Rhys Patchell finished a slick team move to ease home nerves, but a try from Roddy Grant set up a grandstand finale as Blues clung on to record a crucial league win.
Strong running from Gavin Evans and Patchell in the opening ten minutes forced the first kickable penalty of the match for side entry. But, in gusty winds, Patchell connected well with his kick but pushed it narrowly wide right.
The Scottish lineout was misfiring in the opening 20 minutes and Blues looked to make possession count with a series of pick and goes resulting in a penalty that Patchell this time opted to kick to the corner.
The drive was stopped short but the alert Williams picked up at the back of the ruck and raced over to score for a converted try and 7-0 lead.
Edinburgh looked to respond immediately as they turned down a kickable penalty of their own to also go for the corner. But the impressive Ellis Jenkins pounced at the breakdown to win a penalty for the hosts.
Strong carrying from Sam Hobbs and Josh Turnbull opened up more space before the lively Williams again broke clear and into space to get the BT Sport Cardiff Arms Park crowd on its feet.
In response, Dave Denton and Sam Beard combined for hard yards down middle of field as Scots look to build momentum.
Blues were dealt a blow when Vosawai was yellow carded for a high tackle, but visiting fly half Jade Te Rure makes a mess of his kick and the home side managed to clear.
Powerful running from Tom Isaacs cleared more danger before visiting skipper Mike Coman became the latest man to spend ten minutes off the field when referee Dudley Phillips yellow carded him after illegal work on the floor.
Blues thought they had a second try of the afternoon when some neat handling freed up Jenkins and he popped pass to Evans to dot down. But, after consulting with the TMO, the try was ruled out for a forward pass in the build-up.
The home side, though, were not to be denied a minute before the break with Jenkins again prominent.
Patchell and Evans combined before Jenkins burst down field. The ball was kept alive and when Isaacs fed Jenkins the flanker finished the move he started as he slid over to a huge ovation.
Rattled Edinburgh looked to respond after the break with Phil Burleigh cutting a hole in the home defence before second half replacement Heathcote slotted a simple kick to open the Edinburgh account after 45 minutes.
Growing momentum was now with Edinburgh and a try was ruled out when the visitors ripped ball in the home 22 and went wide before the forwards burrowed over. The players claimed the try but after consulting the TMO the score was disallowed.
However, there was no stopping big wing Tim Visser on 55 minutes when he handed off a man and raced over to cut the lead to four points.
Blues needed a foothold and got it as replacement Macauley Cook produced two barnstorming runs. And when the ball was shipped wide it was Tuculet who unselfishly fed Patchell to dive over. Patchell then picked himself up and slotted a laser like kick from the tramlines for a 21-10 lead.
Edinburgh hit back within minutes as the game swung from end to end as, with Josh Turnbull yellow carded and the pack a man down, a driving lineout was scored by Grant.
A tense final ten minutes saw Tuculet relieve pressure with an outstanding high take close to the touchline from William’s up and under as the rain started to belt down.
Dougie Fife was yellow carded for a dangerous tackle in the air, but it was Edinburgh who finished strongly before one last turnover ended home nerves and secured the win.
18m L. Williams t Patchell c 7-0
39m Jenkins t Patchell c 14-0
45m Heathcote p 14-3
55m Visser t Heathcote c 14-10
65m Patchell t Patchell c 21-10
70m Grant t 21-15
Cardiff Blues: 15 Joaquin Tuculet, 14 Richard Smith, 13 Cory Allen (Thomas 40), 12 Gavin Evans (G Davies 56), 11 Tom Isaacs, 10 Rhys Patchell, 9 Lloyd Williams; 1 Sam Hobbs, 2 Matthew Rees (Dacey 62), 3 Adam Jones (Filise 44), 4 Filo Paulo (Reed 53), Jarrad Hoeata, 6 Josh Turnbull, 7 Ellis Jenkins, 8 Manoa Vosawai (Cook 62)
Replacements: 16 Kristian Dacey, 17 Thomas Davies, 18 Taufa’ao Filise, 19 Lou Reed, 20 Macauley Cook, 21 Tavis Knoyle, 22 Gareth Davies, 23 Adam Thomas