Cowboys top Giants in thriller