You can do it by updating 2 options.
<?php
//This could be page or posts.
update_option('show_on_front', '<posts/page>');
//This one sets the page you want on front, won't work if the above option is set to 'posts'.
update_option('page_on_front', '<id of the page you want to set as front page>');
?>
Though I cannot guarantee if this is safe and whether it will override the settings saved from the backend!