Untested, but I’d start with something like this:
add_action( 'wp', 'your_function', 3 );
function your_function(){
if ( is_page_template( 'some-template.php' ) ) {
if( some condition )
locate_template( array( 'some-other-template.php' ), true );
else
return;
}
else
return;
}