I tried:
update_post_meta($post_id, ‘_thumbnail_id’, $image_id);
It sets my image as featured image, and it displays correctly, but the image is still unattached to the post, therefor not in the media uploaded to post list.
I found this function, wp_media_attach_action(). Not sure how to use it though.