Ayoze Perez's first-half goal earned Newcastle a fortunate first Premier League away win of the season as they leapfrogged Bournemouth in the table.