Thanks for the hypothetical question.
If someone received the Anointing of the Sick then immediately dies, if they were truly sorrow for their sins when they received this sacrament, Yes, they would go immediately to Heaven.
The situation would be analogous to if someone was just baptized into the Catholic faith then immediately died for some reason.
If one died without receiving the sacraments and at death had no unconfessed mortal sins on their soul, any remaining selfishness on the saved soul would be purified in the Holy Hospital of Heaven, Purgatory.
For those reading this who have a hard time understanding this teaching, this posting may help.
I hope this helps,