Once you’re in the template it’s too late, as headers have already been sent. You have to hook earlier in the request to check, like the template redirect hook:
add_action( 'template_redirect', 'wpse52455_redirect' );
function wpse52455_redirect(){
// do your check and call wp_redirect here
}
Note that this will get called on every request, so you also need to do a check that the current page is your edit page.
EDIT – the above code should go in your theme’s functions.php
file.