You can show an alternate message or area of the page with your if statement by adding in an else like this:
<?php if (isset($_REQUEST["ref"])) { ?>
<h2>Thank You!</h2>
<p>Thank you for submitting your Mortgage Enquiry search.</p>
<p>We will be in contact with you shortly.</p>
<?php } else { ?>
the form goes here
<?php } ?>
This will show either the thank you message or the form, but not both.