Convert a node from one content type to another, using a rule set
Node Convert might help you with the node conversion from one type to another. http://drupal.org/project/node_convert

I'm not sure if you can use this module to do it programmatically, but it might help to look at this structure and run something similar on a cron job.