Heat oven to 200C/180C fan/gas 6. Peel the shallots, cut in half lengthways and place in a single layer on a baking tray, cut-side up. Drizzle with the oil, season well and bake for 20-25 mins. Take the tray out of the oven and drizzle with the balsamic vinegar. Sprinkle with the sugar and return to the oven for 10 mins more or until golden brown and softened. Leave to stand for 10 mins.
Unroll the pastry onto a work surface lightly dusted with flour and cut out 4 x 13cm discs (or 6 x 11cm discs if making for starters), using a bowl or saucer as a guide, if you like. Divide the shallots between 4 x 12cm non-stick, preferably loose-based mini cake tins (or 6 holes of 2 x 4-hole non-stick Yorkshire pudding tins), arranging cut-side down, nice and snugly. Scatter the chestnuts on top and press down lightly. Sprinkle with the thyme leaves and season. Place a disc of puff pastry over the shallots and chestnuts in each tin and ease down the sides using a round-bladed knife. Prick with a fork all over. Can be frozen at this point (see tip, below left) or covered with cling film and kept in the fridge for up to 8 hrs before baking.
To make the mushroom sauce, put the dried mushrooms in a measuring jug and cover with 200ml just-boiled water. Leave to stand for 20 mins. Drain in a sieve and reserve the soaking liquor. Put the mushrooms on a board and roughly chop. Heat the oil in a medium frying pan and fry the chestnut mushrooms over a high heat for 2-3 mins until lightly browned. Reduce the heat, stir in the butter and, as soon as it has melted, add the flour and the soaked mushrooms and cook for a few secs, stirring.
Slowly add the mushroom liquor, taking care to avoid adding any gritty bits from the bottom of the jug, then add the Madeira, stirring well between each addition. Bring the sauce to a simmer and cook for 2 mins, stirring. Adjust the seasoning to taste.
Heat oven to 220C/200C fan/gas 7. Place the cake tins on a baking tray and bake the Tatins for 20-25 mins or until the pastry is golden brown and risen. Leave to cool for 5 mins, then turn out onto warmed plates. If the shallots stick to the tin, gently ease them out with a round-bladed knife and rearrange them on the pastry. While the Tatins are resting, gently warm the sauce. Spoon the mushrooms on top of each Tatin and allow the sauce to drizzle onto the plates. Garnish with more thyme and serve with the vegetables.