Preheat oven to 400°F. Toss Brussels sprouts with olive oil, season with salt and pepper, and roast for 20 minutes.
In a skillet, cook pancetta until crisp, then remove and set aside, leaving the fat in the skillet. Add butter and shallots to the skillet, cooking for about 5 minutes until softened.
Whisk in flour, then add milk and thyme. Let the sauce thicken and season with salt.
Toss roasted Brussels sprouts with pancetta and sauce, then transfer to a baking dish. Reduce oven temperature to 375°F.
Top with Gruyere and Parmesan cheese, then bake for 30 minutes until golden and bubbly. Optional: add pecans for extra crunch.