you can safely uninstall the OX App, and then install the mailserver app. The mailboxes will not be deleted. OX does not handle mail itself. It uses the UCS mailserver components for that. Those will be reinstalled once you install the mailserver app.
Mailboxes will not even be deleted if users are removed, unless the UCR variable mail/dovecot/mailbox/delete has been set to yes/true.
See http://docs.software-univention.de/manual-4.2.html#mail::renamedusers