Hi vegfarmer,
welcome to the Apple (user-to-user) Community.
Re: "I accidentally hit some key that overlaid a 'jpg' icon on top of the image, making it useless. I can't get it off".
Commiserations, seems you have lost that original image. Maybe you can retrieve a copy you shared via an eMail,
or you may have a copy on another device, or in a back-up.
_______________________________________________________________________________________________
Re: "I did nothing to save the image with the overlay, Preview appears to automatically save anything I do with or without my OK".
Seems that when using Preview, if we initiate certain changes involving a choice of options, on closing those options the current option in use is applied / saved so it is not lost. One can generally choose from the options to return the image to the original before quitting the procedure.
_________________________________
Re: "How do I prevent this in the future."
Although it may be too late for the current image: Preview has "Edit > Undo" (or use the keyboard shortcut: Control+Z) for immediately reversing accidents or mistakes by going back a step. We're always in charge.
It is good practice to choose "File > Duplicate" before working on any image. You can work on the copy, and there is always that one original copy safely available. Also, you can easily compare the "before" and "after" versions.
You can get more familiar with the way Preview works by browsing the Preview User Guide, and trying out ways of working with it. Experimenting creatively can be fun, and productive if you are interested.
Another option is to do image-editing in the Photos app.
All the best :-)