Mark Williams' World Snooker Championship campaign was marked by a moment of frustration as he punched his cue and then handed it to a spectator, before being knocked out of the tournament.