Cut pepperoni into fine strips. Halve onion lengthwise and also cut into fine strips. Finely chop garlic.
Lightly heat 2 1/2 tbsp olive oil. Add all vegetables, season to taste with salt, pepper and thyme, and fry for around 10 minutes.
Mix corn starch with milk in small pan. Grate Gruyère AOP and pour into milk. Cook on low heat while stirring until Gruyère AOP has melted and cream becomes creamy. Let cool a bit, mix in egg yolk, and season to taste with salt, pepper and some finely grated nutmeg.
Heat remaining oil. Season chicken breasts with salt and pepper and fry in hot oil 1 1/2 minutes on each side.
Place pepperoni and vegetable mixture in gratin dish. Lay chicken breasts on top then pour in Gruyère AOP sauce. Brown in middle of oven preheated to 200° C. for 20 minutes.