Why can a gyroscope go upright for a while, after losing some energy? There are many questions about gyroscopes, and this one: (Confusion about what happens when the rotating axis of a gyroscope is rotated) remind me of an odd behaviour of a toy gyroscope that I had. 
It is made in a way that besides the rotor, also the case spins when placed on the ground. So, I think it is not same situation described by that question.
The expected behaviour is an increased precession as the system loses energy until falls down. And it happened many times indeed. 
But sometimes the outcome was different: after some time of precession, its axis changed from a tilted to a vertical direction, stayed there for some time (without precession) until the angular velocity decreased too much and it fell down. 
I made a video of one of that events: (https://www.youtube.com/watch?v=UZYlW6ErqdI)
May be the existence of 2 rotating coupled bodies is the reason, but I don't know how it could lead to such a counter intuitive movement. It seems that some of the lost kinetic energy is transformed in potential, raising a little bit the centre of mass of the device.
 A: There is something humbling in the case that you present.
You see: for the purpose of expression in mathematics the description is always an idealized system. Generally the mathematical description is in one of the following two categories:


*

*The point of contact with the ground is so sharp that the contact point can be treated as a needle point. The contact point cannot slide.

*The point of contact moves over the surface that it is resting on without any friction.
Well, with the spinning top you are showing neither is the case.
The fact that the spinning top finds a path to vertical is in itself proof that it has sufficient grip on the surface to raise its own center of mass.
Ironically it is the poor manufacturing quality that happens to give that spinning top that surprising capability. Ideally the frame shouldn't partake in the spinning. With this top the frame is dragged along to significant angular velocity.
By the looks of it: that spinning top is walking around.
If you would sharpen the contact point to a needle point, and you would place it on a surface such that it cannot walk around I expect that spinning top to just lean over more and more.
In this particular case it just so happens that as the spinning top slows down there is a path where the spinning top walks itself to vertical orientation.
