1. Cook beans in batches in a large pot of boiling salted water until crisp-tender, about 3 minutes. Transfer with a slotted spoon to a bowl of ice water to stop cooking. Drain beans and pat dry.
2. Combine mushrooms, chopped shallots, garlic, and thyme in a large bowl. Melt 1 tablespoon butter in a large nonstick skillet over moderately high heat. Saute mushroom mixture in 4 batches, seasoning with salt and pepper and adding 1 tablespoon butter to each batch, until golden brown, about 4 minutes per batch, until golden brown, about 4 minutes per batch. Transfer to a large bowl and cool. Gently toss together with beans.
3. Preheat oven to 375 degree F. Heat oil in a small wide saucepan over moderately high heat until hot but not smoking and fry sliced shallots in small batches until golden brown and crisp, about 1 minute. Transfer with a slotted spoon to paper towels to drain; season with salt and pepper.
4. Butter a 2-quart ovenproof casserole dish or ceramic crock. Heat half-and-half in a small saucepan over moderate heat just until hot (do not boil). Melt remaining 2 tablespoons butter in a medium saucepan over moderate heat and whisk in flour. Cook flour mixture, whisking constantly, until pale brown, about 1 minute. Immediately whisk in hot half-and-half; simmer, whisking constantly, until slightly thickened and reduced to 2 cups, about 3 minutes. Whisk in 1/2 cup Parmesan and season with salt and pepper. Pour sauce over green bean mixture, stirring gently until just combined.
5. Transfer green bean mixture to prepared casserole dish and sprinkle with remaining 3 tablespoons Parmesan and the pine nuts. Bake casserole in middle of oven until bubbling, about 20 minutes. Top with fried shallots just before serving. Makes 8 servings.