You're telling it to echo the Thanks! etc any time the GET variable 'ajax' isn't set, you may want to more explicitly define the case where it should be shown and rewrite the condition accordingly.
You can also consolidate your Success/Failure lines a little; something like: ***edit*** forgot to escape a quote
$msg = $success ? 'Thanks for sending your message! We\'ll get back to you soon.' : 'There was a problem sending your message. Please try again.';
echo '<p>' . $msg . '</p>';