If you remove an old file and import a new one, the old file's metadata, inside of MC, is gone. MC reads the metadata from each file as it is imported. I'm not sure what your procedure was, or what your purpose was in replacing one FLAC file with another, so I might not have the full story.
If you replace a file and keep the file names identical, then there should be no loss of MC data as MC will not see this as a new file. If you tell MC to update by doing Library Tools > Update Tags (from file), then it will read the tags inside the replaced file. If that file happens to contain a Rating field that is empty, it will overwrite the field in MC's internal database. If the Rating field does not exist in the replaced file, then the Rating tag will keep the original value in MC's database.
Brian.