You should limit the filename replacement to each individual instance of the filename that needs resizing.
The problem: clients use the same image in both the thumbnail and the link to the full-size version of it (such as for a lightbox). Example:
<a href="HUGE_IMAGE.jpg"><img src="HUGE_IMAGE.jpg" width="100" height="100" /></a>
Currently, your plugin replaces all of the references to each image everywhere it appears on the page, even when it does not need resizing, causing problems with lightboxes showing tiny images. I would also guess that this causes problems when the same image is used many times on one page, each time using a different size.
Even with these problems, this plugin is really great for clients that are in too much of a hurry to pre-resize images before uploading. Thank you, it’s very useful!