Third seed Sam Querrey beat former world number one Lleyton Hewitt to reach the quarter-finals of the SAP Open in San Jose.