You will need to upgrade vCenter Server first. Then you can vMotion all guests to one of the hosts that vCenter is managing and do the clean install of the other host. Once the install is complete, configure ESXi (storage, networking, security, etc) and join it back to the vCenter Server. Then you can migrate the VMs to the 5.1 host and repeat the process on the remaining host. Your VMs should stay up for the entire process.
Of course, you will want to make sure your hardware is on the HCL and you might also want to consult the VMware Product Interoperability Matrixes.