The pulsating match was on the verge of a drop goal competition when Williams took his opportunity.
Pride and passion were top of the agenda as Gloucester came from behind and stood proud during possible one of the best games this season.
Two penalties to each side saw the game stand at 6-6, when Bath, against the run of play, scored through Joe Maddock. Malone's conversion took Bath into a 13-6 lead.
Two more penalties from Henry Paul and another from Malone saw Bath take a 16-12 half time lead.
But that doesn't give any indication of the thrilling encounter on show at a packed Kingsholm.
A ferocious opening 20 minutes of the second half was followed by an outstanding score from Seti Kiole, after a tricky run from James Simpson-Daniel. Paul's conversion took Gloucester into a 19-16 lead, before a 67th minute penalty from Chris Malone drew the game level at 19-19.
Gloucester had their chances in the second half but the Bath defence held out, as the game crept into extra time, and Williams' score.
Match Summary
2 mins:
Olly Barkley's kick ahead looked to have been easily covered by Garvey, but Gloucester were penalised for impeding the on-rushing Bath attackers and Malone had the first chance for points, which he slotted.
(3-0 to Bath)
5 mins:
Bath won turnover ball from Henry Paul as he took the play in contact on half-way. Olly Barkley broke clear and off-loaded to Matt Perry who was tackled by Seti Kiole. Bath recycled, and Stevens took it on. Gloucester's Nick Wood and Hazell did well on the floor to win ball. Paul kicked ahead into open space and Simpson-Daniel chased. Bath's Scaysbrook impeded Simpson-Daniel, and Henry Paul had a penalty attempt, but he miscued it and the chance went wide.
7 mins:
Gloucester continued to counter and stretch Bath as the visitor's defence was penalised again in front of the posts. Paul slotted it perfectly.
(3-3)
8 mins:
Straight from the re-start Gomarsall was penalised. Malone's kick was good.
(6-3 to Bath)
11 mins:
Gloucester stretched Bath further as Gomarsall recycled after good work from Balding in front of the Shed. Paul spread it wide to Fanolua, who had Hazell on his shoulder. The England open-side found Buxton, who exchanged a lovely couple of passes with Seti Kiole close to the edge of the pitch. Bath were penalised as Gomarsall switched to the other side of the pitch. Henry Paul took the three points.
(6-6)
15 mins:
A good break from Olly Barkley on half-way set up the first scrum of the match on the Gloucester 22.
17 mins:
Superb work from Balding at a Bath scrum as he turned the tackler gave Gloucester possession at the set-piece.
But Gomarsall's missed touch kick gave Matt Perry the chance to return the ball. The Bath half-backs caught Gloucester short and Geraint Lewis broke 20 metres down the blind side. Joe Maddock was in support at full pace and he sprinted through for the try. Malone converted.
(13-6 to Bath)
21 mins:
Straight from the restart Gloucester again, hammered their way at the Bath defence inside the visitor's 22. Henry Paul was at the heart of the moves as referee Rowden continued to play advantage. Simpson-Daniel's cut inside almost gave the try scoring chance, but Paul's three points saw the gap close.
(13-9 to Bath)
24 mins:
Balding came off and Jake Boer replaced him in the back-row.
27 mins:
Gloucester continued to dominate possession, but couldn't break through the Bath defence.
30 mins:
A pressure tackle from Jake Boer on Malone forced the Bath stand-off to fumble the ball and Gloucester's forwards pounced on the retreating visitors to force the foot-in at a scrum.
32 mins:
Gloucester missed a vital try-scoring chance when Paul put the ball wide on the Bath 22. Simpson-Daniel took it on and passed it out wide to Kiole, whose hands let him down.
33 mins:
As the game re-set Bath's Feaunati was penalised, and Paul stepped up for the three points, but the kick went wide.
35 mins:
Bath made one of their rare plays into the Gloucester, and they made the most of it. Higgins broke the tackle and raced 30 metres clear. Grewcock was in support and as the Bath forwards piled in five metres short, Curnier was penalised and yellow carded. Bath opted for the posts and took the three points (37 mins).
(16-9 to Bath)
39 mins:
Again from the re-start Gloucester had all the possession and territory. Eustace tapped a penalty and made 20 metres into the Bath 22. He carried on going and as Gloucester had the over-lap Matt Stevens killed the ball and also saw yellow (40 mins). Paul slotted the three points (40 mins).
(16-12 to Bath)
Half time: Gloucester 12 Bath 16
41 mins:
Gloucester started the second half at top pace and after Goodridge did well to return a Bath kick, Paul and Fanolua combined before Boer forced a penalty, but Paul's kick hit the post. Bath were first to the rebound and were lucky to clear it. The kick gave Gloucester line-out ball inside the visitor's 22, but the set-piece ball was taken into touch.
44 mins:
The two sides then exchanged possession with Marcel Garvey and Jake Boer both vital in the defensive cog. Seti Kiole and Buxton combined on the short side as Gloucester won possession, before Bath countered. The visitors were penalised, but Gomarsall knocked on at the line-out after Goodridge had gone to touch.
45 mins:
Curnier returned to the field.
49 mins:
Stevens returned to the field.
50 mins:
The game continued to flow with both sides having chances, but it was Gloucester that just kept hammering the Bath line. The chances were numerous. Kiole made 40 metres, Buxton was everywhere, and Curnier was also in amongst it all, but just as it looked like a try,Hazell's pass to Garvey went to ground. The game was pulsating, the pace was at the highest level, and Gloucester kept the pressure on Bath. Malone cleared up field, and Gloucester's line-out kept the ball inside the Bath half.
57 mins:
The game was so close and it looked like a mistake would be the only option for either side to score.
61 mins:
It all came together finally. Gomarsall and Paul found Simpson-Daniel inside the Gloucester half, and Simpson-Daniel drew the Bath defence as his pace caused them difficulties. Kiole was on his shoulder and the Tongan wing powered his way through the Bath defence from 40 metres out for the try. Paul converted.
(19-16 to Glos)
64 mins:
Kingsholm erupted and the chants from the crowd were deafening as every Bath mistake and every Gloucester play was cheered.
67 mins:
Eustace was penalised for coming in at the side as Higgins made 10 metres for Bath inside the Gloucester 22. Malone pointed to the posts and slotted the three points.
(19-19)
71 mins:
Delve on for Lewis in the Bath backrow.
73 mins:
Matt Perry knocked on in front of the posts from a high kick from Henry Paul, but Gloucester were penalised at the scrum.
77 mins:
Gloucester held out as Bath took the play to them. Lee Mears broke from the base of a ruck, but Alex Brown's tap tackle saved the day. Malone tried a drop goal, but it didn't get off the ground and Henry Paul cleared. Simpson-Daniel chased the kick and won set-piece possession for Gloucester as Higgins couldn't get clear.
80 mins:
Gloucester had advantage but played on and lost the three point chance. The game continued in open fashion, and Gloucester were held up five metres short.
Henry Paul's last second drop goal went just wide.
End of 80 minutes: Gloucester 19 Bath 19
Extra time:
Sigley replaced Wood and Booth replaced Maddock at the break.
The extra-time started at the same pace that normal time finished. This time Bath had the momentum and Barkley made a number of good breaks.
86 mins:
Bath, again, broke with Steve Booth racing clear from the short side, but Fanolua hauled him down.
87 mins:
David Barnes replaced Duncan Bell.
88 mins:
Alex Brown charged down a Malone kick and Boer picked up. Henry Paul tried a cross-field kick, but Bath covered.
90 mins:
Fanolua cut inside from the base of a ruck and almost got to within 10 metres, but Bath won the foot-in from the next phase.
Half time in extra time:
90 mins:
Cornwell replaced Hazell and Wood replaced Walshe.
92 mins:
Both sides were tired as the players looked for a moment's break.
97 mins:
Malone's drop goal hit the post and Gomarsall cleared up field.
100 mins:
Bell on for Stevens in Bath's front row
Andy Williams then chased his own kick and touched down in the corner for the most dramatic finish possible.