Hernández has winning hit, Jays rally in 10th to beat Royals