insert thumbnail image from php script
You’ll want to take a look at wp_insert_attachment and wp_generate_attachment_metadata. You can’t insert a featured image/thumbnail using the_post_thumbnail – that function only gets the thumbnail for the current post. See: http://codex.wordpress.org/Function_Reference/wp_insert_attachment and http://codex.wordpress.org/Function_Reference/wp_generate_attachment_metadata