Yeah I was going to ask that same question. Perhaps by willingly releasing his heart he 'gave it up' to the darkness in order to rescue the princesses. But he was able to come back because his heart and his bond to Kairi was so strong? Also I thought the strength of the heartless you become is based on how bad you are. Since Sora isn't evil at all he became the weakest heartless. Either way, what happened to him was a unique situation so it probably has unique rules.

For a game about Disney characters it sure has a complex mythology.