You can re-encode a flac file without losing any metadata using only flac itself:
CODE
flac -5 -V -f foo.flac
The above will do what you want. This tells flac to decode foo.flac, re-encode it at compression level 5, verify the new compressed file against the original decoded WAV data, copy all metadata blocks (including tags) from the input flac, and overwrite the original file when done.
The overwriting part sounds scary, but flac actually does all of the encoding to a temp file first, then only replaces your original file if everything was successful. If there was an error or you kill the encoder partway through the process, your original file is still there, completely untouched.