In Linux (Buffalo NAS runs on Linux), all devices (like harddisks or usbdisks) are mounted and dismounted under /mnt directory. This directory is usually not affected by firmware update. So, about the data in hardisks/usbdisks; they will remain intact even when the firmware is corrupted. If the firmware is corrupted, you can still access the data in the harddisks/usbdisks (by mounting them to a Linux machine). In case of RAID-ed harddisks, you need to set up a troubleshooting machine in a RAID mode that matches the setup of the harddisks to recover the data. Unless, the firmware update does something dangerous like wiping the data of mounted devices in the /mnt directory (which never happens), then the data will be affected by this event.
When you ask a factory reset, the scripts under /etc/init.d in your Buffalo NAS firmware will instruct a program /usr/local/sbin/nas_configgen to perform what you have described in the second paragraph. These scripts do not touch anything under the /mnt directory, so your data in the mounted harddisks/usbdisks are not affected by the factory reset.