Dolphins stun Patriots 27-24, denying NE first-round bye