I've had a look and I can't find anyone with the exact same problem (apologies if I've missed it).
I've inserted a gallery, which I then try to edit. If I add images already in the media library, then it's fine. However, if I try to upload an image directly, or upload a new image to the media library, then the whole gallery is replaced with a thumbnail for the last image uploaded. Looking at the html reveals that the gallery is still there (it still contains all the image ids), and removing the last image will make the gallery come back. But it basically means that I can't create galleries with new images.