John Tavares was the hero for the New York Islanders as they snapped a five-match losing streak with a 4-3 win over the New York Rangers.