Does gaining immunity to a condition apply immediately to a current condition?

What happens when a creature gains immunity to a condition while it currently has that condition? (For a list of conditions see Rules Compendium 229–35.)

For example, the level 6 battlemind daily utility power mental triumph (Psionic Power 39), in part, says, “You cannot be slowed, immobilized, or restrained until the end of the encounter.” If Sivart the battlemind presently possesses the condition immobilized and takes a minor action to use the power mental triumph, does he lose the condition immobilized? Or, after he uses the power, must the duration of the condition still expire normally and thereafter—for the encounter’s duration—he can’t be immobilized?

By way of metaphor, can an inoculation also cure the disease?