Preheat the oven to 350°F (175°C). Grease a 1-quart baking dish.
If using fresh pearl onions, bring a small pot of water to a boil. Add the onions and simmer for 6 to 8 minutes until tender, then drain and peel. If using frozen onions, cook them according to the package directions and drain well.
Melt 2 tablespoons of butter in a heavy saucepan over low heat. Whisk in the flour and cook for 1 minute while stirring constantly.
Gradually pour in the half-and-half, stirring constantly over medium heat until the sauce thickens.
Remove the saucepan from the heat. Stir in the salt, black pepper, dry mustard, nutmeg, and 1 cup of the shredded cheddar cheese until smooth.
Gently fold the cooked and drained pearl onions into the cheese sauce.
Transfer the onion mixture to the prepared baking dish. Sprinkle the remaining 1/2 cup of cheddar cheese evenly over the top.
In a small bowl, combine the fresh breadcrumbs, melted butter, and chopped thyme. Scatter the crumb mixture over the cheese layer.
Bake uncovered for 25 to 30 minutes, or until the sauce bubbles and the topping turns golden brown.