Preheat the oven to 400° F. Line a baking sheet with aluminum foil and set aside.
Peel the onions. Trim the stem ends so they will stand upright, and remove 1/2-inch off the top. Rub 1/4 teaspoon of the oil on each onion and season with 1/8 teaspoon of the salt and a pinch of the pepper. Place on the baking sheet and roast until tender and caramelized around the edges, about 45 minutes. Remove from the oven and cool.
When cool enough to handle, push out the centers, leaving a shell. Cut pieces of the removed onions to fit inside each shell to prevent the stuffing from oozing out. Reserve the remaining inner pieces.
In a bowl, combine the mascarpone, thyme, garlic, shallots, remaining 1/2 teaspoon salt, and 1/4 teaspoon pepper, and mix until blended. Stuff each onion with the cheese mixture and return to the baking sheet. Bake until warmed through and the cheese melts completely, 5 to 6 minutes.
Remove from the oven and transfer to serving plates. Place 1 thyme sprig in the center of each onion, and serve immediately with a spoonful of the reserved onion pieces.
Makes 6 servings