Ah, my sister asked the exact same thing but in a different situation; Walrein would forget Ice Beam and learn Sheer Cold without fail. As it's attack, Game Freak caught on, and in this situation Walrein would use Sheer Cold on the target.
So, if a selected move is forgotten, the Pokemon will use the move it was replaced by.