Preheat oven to 400 degrees F. Butter a 1 1/2-quart shallow baking dish.
Bring a large saucepan of salted water to a boil. Peel potatoes and cut into 1/8-inch slices - a food processor is good for this. Add potatoes to boiling water and cook 4 minutes. Drain potatoes thoroughly in a colander.
Arrange 1/3 of the potatoes in baking dish, top with 1/3 of the cheese, 1/3 of the thyme leaves, and sprinkle with salt and freshly ground pepper. Repeat twice more, ending with a layer of cheese and thyme.
Heat milk just to boiling. In a small bowl whisk egg and add hot milk, stirring. Pour evenly over potatoes. Bake 30 minutes, or until top is golden and potatoes are tender.
Recipe courtesy of Ted Allen