That's a good thing. Not the coming out of the pot but the fact that it did.
I suspect you were about to lose your plant because the stem is dried too.
Yes, find a lighter pot (not a bigger pot) and some cactus soil. Dampen the soil. Pull off the dead leaves and place the plant bottom on the soil and press it down gently so that the bottom of the plant has good contact with the soil but is not buried.
It will re-root in a couple weeks. You can water it but do so sparingly.