If mail is queued, and the appliance is dosconnected, it will be lost.
What I like to do is remove an appliance form the mail flow for a period of time before it is fully decomissioned. This allows all the existing mail to process off the system, while not allowing any new mail to accumulate. The new appliance can be installed along side if desired. This works great, unless you have to install the new appliance with the same IP address, then you would need to be down a server while waiting for the messages to finsh processing.
You can also prompt messages to be retried sooner, that will help reduce the queue length.