Suppose a person's wife goes to the hospital to give birth and the husband remained home with the rest of the children. They made up that the nurse will call and let the phone ring once if it is a boy and twice if it is a girl. Friday night the phone rings twice, so the husband decides that on Shabbos morning he is going to name his newborn daughter. Motzei Shabbos he calls his wife and tells her "I named her this morning Raizel after your Great Grandmother". She responds "What! It was a boy!". Does this child that was named in error maintain this name for life?
I'll have to look for sources, but let's consider: the naming is done as part of a Mi Shebeirach that mentions "the new mother ---, and her daughter who was born at an auspicious time, and her name is ---." So if it turns out that the baby was a boy after all, then presumably the whole thing would be a patent falsehood and therefore of no halachic consequence.