omg thnx so much, that had been driving me crazy for sooo long
i was missing one simple line
set_post_thumbnail( 866, $attach_id );
i must have missed that on the codex somehow
here my final code incase it helps anyone
$post_id = 866; // this value is retrived with '$post_id = wp_insert_post(....)'
$filename = "http://www.wheremyfilesat.com/wp-content/uploads/xelb1cnn.jpg";
$wp_filetype = wp_check_filetype(basename($filename), null );
$attachment = array(
'post_mime_type' => $wp_filetype['type'],
'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),
'post_content' => '',
'post_status' => 'inherit'
);
$attach_id = wp_insert_attachment( $attachment, $filename, $post_id );
$attach_data = wp_generate_attachment_metadata( $attach_id, $filename );
wp_update_attachment_metadata( $attach_id, $attach_data );
set_post_thumbnail( $post_id, $attach_id );
Thanks again