Yes works for spheres, and anything esle that has a meaningfull center, but see now the thing is freeze is not really undoable.There is another way one can use to deduce the old position of the origin, and tahts to read the pivot position. Both of theese fail one step removed tough.
then its tx,ty and tz are respectively 0,0 and 0
thats what you asked the computer to do, takes the object moves it to 0 0 0 of its local coordinate and then moves all points of the object in opposite direction so that the object appears not to move. Its a tool to redefine where you THINK the object is. If you dont want to do that dont freeze So those are the global coordinates of the object form now on.
the real question is WHY would anybody want to freeze under theese circumstances in the first place? I mean freeze is like saying well you know what i dont really care for this measurement lets measure form elsewhere. If you ever find yourself in thsi position you sure as hell dint mean this. Now once youve done thet you just thrrew that old info to the garbage bin. After all thets what you instructed the computer to do. So obviously if you move your measurement to a meaningless place then yes you would suffer. But why would you do so in first place?
Its not like you go and paint the car red and then go oh sorry but you know what was the original color. Sorry now we have to peel the color we painted to find out.
Rule of thumb, unless you actually want to move EACH point in your object and measure it form another place, and accept all related consequences. do not freeze. In genreral that means normal users should NEVER EVER need to freeze anything for any reason. Not to mention that it will screw all your attempts to do blendshapes or any other local things of same kind.
Also if your intetion is to be able to move back to origin by putting all channels 0 then theres BETTER ways than freezing!
In any case theres a distinct chance that you think the PIVOT is where the object is
In that case the answer is easy the object is at
import maya.cmds as cmds
object="nurbsSphere1"
position=cmds.xform(object, query=True, scalePivot=True, worldSpace=True)
But obviously pivots move about.