Preheat oven and prep dish: Preheat the oven to 350°F and butter a 9x13-inch baking dish so the potatoes don't stick as they bake.
Dry the hash browns: Pat the thawed hash browns dry with a clean kitchen towel, pressing firmly to remove as much water as possible. This keeps the casserole from turning watery.
Mix the base: In a large bowl, stir together the hash browns, half the melted butter, sour cream, soup, cheese, onion, salt, and pepper until evenly combined.
Spread into the dish: Transfer the mixture to the prepared baking dish and smooth it into an even layer with a spatula.
Prepare the topping: Toss the crushed cornflakes with the remaining melted butter until evenly coated and the cereal looks shiny.
Add the crust: Scatter the buttered cornflakes evenly over the potato mixture, covering the surface in a loose layer.
Bake until golden: Bake uncovered for 40 to 45 minutes, until the topping turns deep gold and the edges of the casserole bubble.
Rest before serving: Let the casserole sit for 5 minutes out of the oven so the sauce thickens slightly and holds its shape when scooped.