Pour any liquid from the bottom of the tray away, and leave to cool for 20 minutes until they are cool enough to touch.
Pull out the centres of the onions by gently squeezing them, they should pop out of the top, or use a spoon to scoop out the layers. Leave about 4 or 5 outer onion layers as a shell. Finely chop the soft onion middles, season with salt and lots of black pepper, and add a pinch of thyme leaves, and pack into the onion shells to fill them about 2cm up. Discard any onion left over (or use for soup). Mix the cheese, garlic, nutmeg, half the thyme leaves and season. Spoon into the onions on top of the chopped onion, packing the cheese in densely, as the cheese will melt and reduce when cooked.