Williams took the opening frame with a break of 71 but his 23-year-old opponent hit back knocking in a break of 77 as he went into a 2-1 lead.
Williams responded with two frames of his own and a break of 73 but Cahill, who knocked Ronnie O'Sullivan out at the World Championship last season, fought back once with a break of 80 to force a decider.
The Welshman won out with a solid break of 94 but on the final black of the match Williams elected not to pot despite being on for a century.
Afterwards the former world champion tweeted that he didn't realise the break he was on.
There were a couple of shocks as well earlier in the day with Luca Brecel losing 4-1 to Lu Haotian whilst Jak Jones beat Ali Carter by the same scoreline.
Earlier in the day defending champion Neil Robertson was eliminated without playing a shot at after flight delays wreaked havoc on the opening day of the snooker season.
The Australian was due to face Robert Milkins in a heldover match but both players were absent.
Amusingly, the scoreboard slowly ticked over from 0-0 to 3-3 as Robertson and Milkins were awarded penalty frames in their best-of-seven counter.
But as neither player emerged for the decider, they were eliminated from the tournament, handing Ben Woollaston a bye into the second round.
"World Snooker won’t reschedule any matches so unfortunately my defence of the Riga masters will go unopposed," Robertson wrote on Twitter.
"Was debris on the on the runway after a private jet landed delaying the flight for a few hours and then the storms came. No flights in the morning to make my 11am."
World number eight Kyren Wilson was among the other players forced to withdraw, with Harvey Chandler, Jamie O'Neill, Duane Jones, Louis Heathcote and Joe O'Connor also affected. In all, 12 matches were walkovers or had no results - although it was not immediately clear if all were due to the weather.
Robertson saw the funny side of the fiasco, tweeting his delight that he was winning frames despite being stranded miles away.