I thought I figured this out a number of times, but I finally got to an answer with a dead simple method.
Go to line 33 and add:
Then go to line 55 (it was line 54 before we added that last line) and replace the entire line with:
<input type="hidden" name="pin_image" id="pin_image" value="'.$attachID.'" />
If you want to make it really easy, replace the entire public function for pinterest_html() with the following line of code; REPEAT - if you did the steps above, you do not need to do this.
[Code moderated as per the Forum Rules. Please use the pastebin]
Basically what we have done is pre-populate the hidden input value with the already saved image ID value. If it does not exist, it outputs nothing and therefore saves nothing if you don't add something. If you click remove a picture you have already save, it will still remove it.
To optimize this code, it would be better to not save a value unless there is a change. My fix always saves a new value, even if it is the same as before. Small price to pay (a few milliseconds?), nevertheless good code is good code.