After re-reading my post I see I was not very clear about the first complication. The complication is from when an image that was initially uploaded for a different post gets reused for a new post by picking it from the image library, as opposed to uploading a new image from offsite with the upload files tab. The new post would then have no attachment representing that image, preventing a useful type of query. In addition, it’s possible for images to be added, usually by some special plugin, bypassing the media manager entirely.
Another complication that occurred to me is if the image in content is linked to a full size image or otherwise linked such that the link needs to be removed along with the image.
Assuming the image was added anew for the post in question, typically the most common scenario, the process would work like this:
1. Query for all posts with postmeta key ‘_thumbnail_id’
2. For each post found, get the image ID of the featured image.
3. Find the related image reference in post content and remove it.
4. Update the modified post.
Test carefully before turning this script loose on your entire DB!
The real trick here is accurately identifying the image reference and removing it without accidentally deleting other data for all the various contexts that it may be found in, or not fully removing related content, resulting in invalid HTML. You might try to find an img tag that has the class “wp_image_{$image_id}”. Another approach would be to determine the base filename and search the content for occurrences of that string, removing the related tags when found. Exactly which and how would depend on what context variations you expect to encounter.