Peel and wash the potatoes and cut them into thin slices. Celery peel, halve and cut into slices. Wash thyme, dab dry and, except for something to garnish, pluck leaves from the stalks and chop.
Grease a suitable gratin dish. Layer potatoes and celery. Mix eggs, cream, milk and thyme, season with salt, pepper and nutmeg. Pour over the potatoes. Grate the pecorino and sprinkle over the potatoes.
Cook in the preheated oven (electric cooker: 200 °C/ convection oven: 175 °C/ gas: level 3) for 40-50 minutes. Peel shallots and cut into pieces. Caramelise 50 g sugar in a larger pot at low heat.
Heat the wine and vinegar. Deglaze caramelized sugar with it while stirring. Add the shallots and simmer for 5-6 minutes. Then season to taste with salt, pepper and sugar. Wash the meat and dab dry.
Heat the oil in a pan. Fry meat for 8-10 minutes, turning. Season meat with salt and pepper, remove and wrap in aluminium foil. Let it rest for about 5 minutes. If necessary, reheat shallots again.
Arrange meat, gratin and shallots with stock on plates, garnish with thyme.