If making the dough in advance, plan for at least 1 hour of chilling time in the fridge (2 hours or overnight if possible).
Briefly whisk the flour, fine salt, and 1 tsp sugar together in a bowl or in a stand mixer fitted with the paddle attachment until well combined.
Add the cool but softened butter and 1/4 cup sour cream (and 2 Tbsp grated Parmesan if using) and mix just until the dough starts to come together, about 20–30 seconds; do not overwork the dough and it’s fine if some butter remains visible.
Turn the dough out onto a lightly floured surface, bring it together into a cohesive ball without overworking, flatten into a disc about 2cm thick, wrap tightly in plastic wrap and chill in the fridge for 2 hours or overnight.
When ready to bake, preheat the oven to 200C/400F and remove the dough to soften just enough to roll; timing will depend on room temperature.
Make the filling by mixing the 250 g ricotta with the chopped parsley, chopped basil and crushed garlic until smooth; season well with salt and pepper.
Slice the tomatoes thickly, lay them flat on a board, season with salt and pepper and sprinkle 1–2 tsp sugar over them; if they seem very wet, drain the slices on a double layer of kitchen paper towel.
Roll the chilled pastry into an even circle about 30cm in diameter, gently lift it with a rolling pin and place it on a large baking sheet lined with baking paper.
Spread the ricotta filling evenly in the center of the pastry leaving a 4–5cm border, then sprinkle 2 Tbsp of the grated Parmesan over the ricotta.
Arrange one layer of tomato slices over the cheese, season with salt and pepper and scatter half the thyme leaves, then add another layer of tomatoes where they fit, top with the remaining thyme and the remaining 4 Tbsp grated Parmesan (or Pecorino), and finish with a light drizzle of 1 Tbsp olive oil and 3 tsp balsamic glaze or vinegar.
Fold the edges of the pastry up and over the tomatoes and ricotta to create a rustic border, then brush the exposed pastry with the beaten egg.
Bake the galette for 40–45 minutes until the pastry is golden brown; if it is browning too quickly, loosely cover the galette with foil from about 20 minutes into the baking time.
Remove from the oven and let cool slightly; serve warm or at room temperature and garnish with extra Parmesan shavings if desired.