To make the pastry, rub together the flour, sea salt and cold butter in a bowl until the mixture resembles breadcrumbs (or blitz in a food processor). Stir in the sugar and gradually add the beaten egg to form a soft, pliable dough (you might not need all the egg). Gently form the pastry into a ball, flatten it, then wrap it in cling film and chill for 30 minutes.
Dust a work surface lightly with flour, unwrap the pastry and roll it out to a 4mm-thick circle. Use it to line a 21–2cm, high-sided, loose-bottomed tart tin, leaving a little excess pastry to hang over the edges. Return to the fridge for 20 minutes.
Meanwhile, preheat the oven to 220°C/200°C fan/gas 7.
Line the pastry case with baking parchment and fill with baking beans. Sit the tart case on a baking sheet and bake in the oven for 10 minutes. Reduce the oven temperature to 180°C/160°C fan/gas 4 and bake the tart case for a further 15 minutes, until it starts to turn golden and becomes firm. Remove the baking beans and parchment, brush with the egg yolk and return the case to the oven for a further five minutes, until evenly golden.
While the tart case is baking, start making the filling. Put the double cream, milk and thyme in a medium saucepan, bring to a simmer and let it simmer for five minutes. Remove from the heat, cover and set aside to infuse for 20 minutes. Strain into a clean saucepan, discarding the thyme and bring back to a simmer.
Place the chocolate in a heatproof bowl and pour the hot cream and milk over the top. Cover and leave to sit for five minutes. Add the eggs and, using a stick blender, mix until well combined. Pass through a fine sieve into a jug.
Reduce the oven temperature to 140°C/120°C fan/gas 1. Remove the oven tray slightly from the oven. With the tart case in the oven, pour the chocolate mix into the shell. Sprinkle the raspberry pieces on top and, using a spoon, swirl to distribute evenly.
Bake the tart for 40–45 minutes until there is just a slight wobble in the middle. Carefully remove from the oven and leave to cool. When cool enough to handle, trim away the excess pastry with a sharp knife, and when fully cool remove the tart from the tin.
To serve, dust with the cocoa powder and slice using a hot knife.