Preheat oven to 425 degrees F.
Make the pie dough. Combine all-purpose flour with salt, grated parmesan, and cold butter. Use a food processor, pastry blender, or your hands to mix until well combined. The mixture should resemble coarse sand. Add 3-4 tablespoons of ice-cold water, mixing just until the dough comes together. Shape into a disc and wrap in plastic wrap. Chill in the fridge for 30 minutes.
Meanwhile, make the filling. Heat 1 tablespoon of oil in a large saute pan over medium heat. Add sliced onion and season with 1 teaspoon salt. Saute until softened, about 10 minutes. Reduce heat to medium-low and continue to cook until caramelized, about 45 minutes. Add sherry wine and beef stock and increase heat to medium. Continue to simmer until all of the liquid has evaporated. Remove from heat and let cool.
Combine the caramelized onions with black pepper, fresh thyme, sour cream, and gruyere, stirring until well combined.
Dust a clean work counter with flour. Roll out the pie dough into a large circle, about ¼ inch thick. Spread the onion filling in the center, leaving a 1-inch border. Fold over the edges to create a crust.
Brush the edges with heavy cream and sprinkle grated parmesan on top. Bake for 20-25 minutes or until golden brown. Let cool for 10 minutes. Serve warm.