This happens when angles exceed the valid limits of Euler angles.
Tilt is only defined between -90 and +90 degrees. When you exceed 90 degrees, the engine tries to guess what you intend with that value. In your case the engine comes to the conclusion that you probably want the flip your object upside down - so it reduces the tilt angle, but flips pan to 180 degrees. Therefore your object is oriented like you want it - but its angles are corrected by the engine to valid Euler angle values.
vec_diff won't deliver an angle difference - it is only for coordinate differences.