Treviso looked the better side throughout the game and started with a fine Williams try after 10 minutes.
Fly-half Kris Burton sought to give returning centre Tommaso Benvenuti time on the ball and the 17-cap Italian international showed his class when he shimmied through a half-gap in Glasgow's defence.
He passed onto Williams on halfway and the winger easily beat the Warriors' cover tacklers to score his sixth league try of the season but Burton missed the conversion as the heavens opened in northern Italy.
As conditions worsened Glasgow opted to keep the ball in the forwards and in the 20th minute Alastair Kellock drove forward and from the resultant ruck Treviso lock Corniel Van Zyl was penalised for offside and Duncan Weir slotted home.
Despite the conditions Treviso, in their last home game of the season, maintained their running game and scrum-half Edoardo Gori and full-back Luke McLean made inroads with some mazy runs.
On the half-hour mark Gori picked a fight with Glasgow captain Kellock, 10 and a half inches taller than himself, but referee Leighton Hodges wasn't impressed with either party, sending them both to the sin bin as Treviso went in at the break 5-3 ahead.
Franco Smith's men cranked it up a gear in the second half and Glasgow's half-backs Chris Cusiter and Weir both had kicks charged down but points weren't forthcoming for the Biancoverde, Burton's drop-goal attempt fading wide in the 51st minute.
Glasgow have only lost once in their last seven matches and were determined for their play-off push not to be undone by the Italians.
Full back Stuart Hogg sparked a counter-attack, off-loaded to replacement Pyrgos who quickly transferred the ball to centre Graeme Morrison and Glasgow went to within yards of Treviso's line.
The Italians strayed offside and Weir made them pay with a cool penalty to put the Warriors in the lead for the first time on 61 minutes.
Blazing sun had replaced rain by this stage and on the drying pitch Treviso ran the ball from all quarters.
Their endeavour paid off when Glasgow pulled down an attacking maul and Burton put Treviso ahead with a penalty.
But van der Merwe picked his moment and a delicious line through Treviso's defence for a timely try that Ruaridh Jackson converted to make sure of the win.
|Benetton Treviso Score Card|
|Glasgow Warriors Score Card|
|DTH van der Merwe||1||5|