Preheat the oven to 180ºC/gas 4.
Trim the bases of the celery hearts and peel the outer stalks, keeping each heart in 1 piece. Trim the ends so the hearts are 12 to 15cm long. Cut the celery lengthways into quarters, then across in half.
Peel and slice the onion lengthways, and peel and finely chop the garlic. Pick and finely chop the thyme leaves, then chop the pancetta or bacon
Place a saucepan over a medium heat and add a splash of oil. Add the onion and pancetta or bacon, and cook for a few minutes until the onion is soft. Add the celery and cook with the lid on until the celery is soft.
Heat another pan and add a splash of oil. Add the garlic and fennel seeds, then, when the garlic’s golden brown, tip in the tomatoes. Fill the tomato tin with water and add that, along with a good pinch of sea salt and black pepper. Cook the sauce over a medium heat for half an hour or so, until reduced and thick.
When the celery’s soft, remove the lid and let the ingredients brown slightly on the bottom of the pan.
Lightly oil a shallow 20cm x 20cm baking dish and spoon a little tomato sauce in the bottom. Spread it out and top with about a third of the celery pieces. Cover with more tomato sauce, some thyme leaves and a good grating of Parmesan. Keep layering, then finish with the last of the tomato sauce, lots of cheese and a sprinkle of sea salt and black pepper.
Bake for about 20 minutes, or until heated through and crisp on top.