Place a small cup of water in the freezer about 30min before you start to cook.
For the pastry, pulse the flour, butter and sugar in a food processor until it looks like rough breadcrumbs.
Add the egg yolk and 1tbsp of the ice-cold water, then briefly pulse again until the mixture forms into large clumps.
Tip on to your work surface and bring together into a ball. Flatten into a thick disc, wrap and chill for 45min.
For the frangipane, beat the butter and sugar together until pale and fluffy.
Add the egg and beat again.
Fold in the ground almonds, desiccated coconut and lime zest to make a paste.
Toss the cherries in a bowl with the lime juice and vanilla bean paste.
Combine the icing sugar and cornflour and sprinkle over the cherries. Mix until the icing sugar mixture has dissolved.
Place the dough between two large pieces of baking paper and roll out to a large disc roughly 36cm in diameter.
If the dough becomes too soft when rolling, slide on to a tray and return to the fridge for a few minutes.
Spread the frangipane in an even layer on pastry, leaving a 5cm border.
Arrange the cherries over the frangipane – it’s fine if the edges of the frangipane aren’t fully covered.
Fold in the edges of the pastry to overlap the filling. Transfer to the fridge for 20min.
Preheat the oven to 180°C (fan 160°C) gas 5 with baking parchment on the middle shelf.
Brush the exposed edges of the pastry with the beaten egg.
Sprinkle over the Demerara sugar followed by the coconut flakes.
Transfer to the oven and bake for 55min to 1hr, or until the pastry is deeply golden and cooked throughout.
Remove from tray and leave to sit for 15min.
Heat jam in microwave and brush over cherries. Serve with ice cream.