I went with a similar solution to what NumberXaero posted and it worked fine. Thanks everybody for your effort!
If you want to have a better understand why NumberXaero method works is because you are not accumulating the rotation over time. The reason why you get this weird tilt is because i bet you were doing rotation*=currentRotation, so the tilt you were getting is correct. By rebuilding the rotation matrix you change the order in wich the rotation are applied which in terms give you the correct orientation.