Whisk the flour, sugar, and salt in a large bowl.
Cut in the cold butter until pea-size pieces remain.
Add ice water, one tablespoon at a time.
Mix just until the dough holds when pressed.
Divide the dough into two discs.
Wrap both discs and chill for at least 1 hour.
Add the blueberries to a large bowl.
Stir together both sugars, cornstarch, salt, and cinnamon.
Pour that mixture over the berries.
Add lemon juice, lemon zest, and vanilla.
Toss gently until the berries look evenly coated.
Roll one dough disc into a 12-inch circle.
Fit it into a 9-inch pie dish.
Spoon in the filling and scrape in all the juices.
Dot the top with the small butter pieces.
Roll the second dough disc into another circle.
Lay it over the top, then trim and crimp the edges.
Cut vents in the top crust.
Whisk the egg with the water, then brush it over the top.
Sprinkle on coarse sugar, if using.
Chill the assembled pie for 15 minutes.
Start the pie at 425°F.
Bake it for 20 minutes to set the crust and get things moving.
Then reduce the oven to 375°F and keep baking for 40 to 50 minutes.
Put the pie on a sheet pan if you can.
If the edges brown too fast, tent them loosely with foil.
Let it cool at least 4 hours before slicing.