> The gallery system looks like it might be more complicated than the ones I mention above, and I'm not sure if that's safe or if it might disturb some other area in TP's internal management.
I think only the developers (who don't seem to visit here often) can provide you with a definitive answer to that question, but I wouldn't expect any problems because gallery entries, as I understand them, are basically just pointers to the real file's thumbnail record.
I'm only aware of one feature that finds copies of images in galleries (i.e. works the other way around), and that's when you view the properties [Alt+Enter] of a regular thumbnail and look in the Galleries tab. I think that TP just performs a quick, temporary search at that point to find that particular file in any galleries, but theoratically, it might be keeping track of a thumbnail's gallery entries elsewhere in a table, and in that case, blindly deleting gallery records without updating that other table might indeed break something. If I were in your shoes, I think I'd just create a test database and check what happens in the database when you create (and later delete, through SQL) your first gallery and gallery entry, and what happens in the corresponding file's Properties dialog after you have deleted it. Afterwards, you could also see if the built-in Database | Compact and Repair functions show any hiccups.