From 2006 but I don't think the criterion has changed:
http://www.theguardian.com/football/2006/aug/23/theknowledge.sport
"As a rule, if the initial attempt is goalbound it is credited to the player making the goal attempt," explained a Premier League spokesman. "However if the deflection means that a wayward effort results in a goal then it is attributed to the player who had the last definitive touch of the ball."