Orient And Origin To Selected
Why does my mesh jump after I undo?
Blender doesn't expect you to be able to manipulate the object origin while in Edit Mode, so it moves the mesh back to where it was relative to the object origin without moving the object itself back as well. You'll need to hit undo once in Edit Mode and once in Object Mode after Origin to Selected in order to get back to where you were.