Crossing over the upwind leg while there is traffic is not only illegal, but is very dangerous. I am certain that the evasive action taken prevented the collision of the two aircraft.