Preheat the oven to 350 degrees . Drain the onions, reserving 1/2 cup of their liquid. In a large saucepan, melt the butter over medium-low. Add the flour; whisk until pale yellow, about 3 minutes. Gradually whisk in the cream, stock and reserved onion liquid. Increase the heat to medium-high; cook, stirring often, until thickened and smooth, about 5 minutes. Remove from heat. Stir in the cheese and parsley; season with salt and pepper. Stir in the onions. Transfer to a shallow 3-quart baking dish. Cover with foil.
Bake 10 to 15 minutes, stirring once or twice. Remove from the oven; preheat the broiler. Remove foil and broil until browned and bubbling, about 5 minutes.