Preheat oven to 160C. Process flour and 2 tsp sea salt in a food processor to combine, add butter and process until sandy. Add egg and sour cream, pulse until mixture forms a ball, then press evenly into a 20cm x 30cm oven tray lined with baking paper. Refrigerate to rest while you make the onion and sour cream filling.
For onion and sour cream filling, cook speck in a large frying pan over medium-high heat, stirring occasionally, until just crisp but not coloured (4-5 minutes). Add onion and butter and cook, stirring occasionally, until tender and translucent (15-20 minutes). Transfer to a bowl and set aside to cool. Whisk sour cream and eggs in a separate bowl to combine, whisk in flour, then Gruyère and season to taste. Fold into onion mixture and season to taste with sea salt, freshly ground black pepper and sweet paprika.
Spoon filling evenly over pastry and bake until golden and set (30-40 minutes). Cool slightly, then cut into rectangles and serve warm or at room temperature.