I think you're confusing some terms here -- the operating system is the firmware. The ROM, as enthusiasts say.
If you use FlashTool or Sony's PC Companion to flash the ROM (an .ftf file), then your recovery will be deleted. If you use your recovery to flash the ROM (in .zip format) then no, if the kernel inside that ROM has a recovery included (or supports TWRP).