I’ve just tested from here and I am able to replace a file at the same time as changing it to public without having it duplicate. I can also change it back to private.
I wonder if it could have been a temporary glitch with Flickr? Or, could it be one of the other changes such as changing a tag or the Photo Set or something like that? I know there have been issues in the past with the Photo Set, and as a result if you change it in Ribbet you actually can’t replace.
Would you mind checking to see if you can switch to public now without it duplicating the image?