Did you try placing the original in the trash and then just putting the new one where it was. That should work around replacement issues.
Granted invisible files are invisible for a reason. What file are you trying to replace. It could cause issues if not done correctly.
I tried replacing an invisible file and of course got an error, saying the file can not be replaced because it is invisible.
I used some apps to show the hidden files and although i definitely saw more files, the file i tried to replace was still hidden. And I could not replace it again.
Can you help me with a method of showing all the invisible files or forcing a replacement of an invisible file?