The problem happens only for one reading, until you reach the next time around.
You can ignore this specific reading by a simple test:
if abs(new_track - old_track) < x then
.....
end if
where X must be larger than the maximum expected turn per second.
for continuity of display use for this specific "non reading" the previous value.
Edit:
If you do want that reading, since you know by using the test above that you have the difference of 360 degrees to the result, add or subtract according to the sign of the difference, the value 360.