For the Crust:
3 1/2 cups all-purpose flour, plus more for dusting
1 tablespoon sugar
1 1/2 cups unsalted butter, cubed (keep cold in the freezer)
For the Filling:
4 tablespoons extra-virgin olive oil
1 large onion, thinly sliced
4 large red-skinned potatoes (1 1/2 pounds), unpeeled
2 gala apples, unpeeled
2 sprigs fresh thyme, leaves stripped
3 tablespoons breadcrumbs
10 ounces white cheddar cheese, shredded
Heavy cream, for brushing
Make the crust: Pulse the flour, sugar and salt in a food processor. Add 1 stick butter and pulse until combined. Add the remaining 2 sticks butter and pulse three times, or until the mixture resembles coarse meal. Add the vinegar, then gradually add 1/3 cup ice water through the feed tube, pulsing four times, until evenly combined. Squeeze the dough between your fingers. If it doesn’t hold its shape, add up to 2 tablespoons ice water and pulse two more times (the dough should still be crumbly). Turn out onto a clean surface and press into a ball; divide in half, wrap in plastic wrap and flatten into two 1-inch-thick rectangles. Refrigerate at least 1 hour or up to 2 days.
Make the filling: Heat 2 tablespoons olive oil in a skillet over medium heat. Add the onion and cook until slightly brown, 5 to 7 minutes; season with salt and let cool. Slice the potatoes and apples very thinly; toss in a bowl with the thyme, the remaining 2 tablespoons olive oil, and salt and pepper to taste.
Line an 8-inch square baking dish with foil, leaving a 1-inch overhang on all sides. On a floured surface, roll out one piece of dough into a 12-inch square, about 1/8-inch thick. Transfer to the prepared dish, tucking the dough into the edges and corners; do not trim the overhang. Sprinkle the breadcrumbs over the dough and add the onion. Lay the mortadella on top, then sprinkle with about one-third of the cheese. Layer half of the potatoes and apples on top in a single layer, then sprinkle with another one-third of the cheese. Top with the remaining potatoes, apples and cheese.
Roll the remaining dough into a 12-inch square and place on top of the filling. Press the overhang of the two crusts together, then roll the dough under itself and pinch to make a 3/4-inch-high edge. Make slits in the top crust with a knife to allow steam to escape. Refrigerate 30 minutes. Meanwhile, preheat the oven to 425 degrees F.