Edit post_content on posts with Featured Image

I would do this as follows:

  1. Back up the entire DB (or certainly the wp_posts table!)
  2. Run this query to get all posts that have a featured image:
    SELECT wp_posts.* FROM wp_postmeta INNER JOIN wp_posts ON (wp_postmeta.post_id = wp_posts.ID) AND meta_key=’_thumbnail_id’;
  3. Export the results to a plain SQL file with SQL inserts
  4. Do your search and replace within that SQL file
  5. Reimport the data.

This assumes your tables have the default prefix obviously.