Preheat the oven to 400 degrees F. Butter a shallow 3-quart baking dish. In a medium saucepan, melt the butter over medium heat. Add the leeks and thyme and cook, stirring occasionally, until the leeks are softened, about 5 minutes. Sprinkle with the flour; stir and cook 2 minutes. Whisk in the milk and half-and-half, bring to a simmer and cook until thickened, about 5 minutes. Season with the nutmeg, salt and pepper. Remove from the heat.
Peel and thinly slice the potatoes about 1/8 inch thick. Spread about 1 cup of the cream sauce in the bottom of the buttered baking dish. Layer with half of the potatoes, half of the cheddar and all of the ham. Spread with another cup of sauce. Layer the rest of the potatoes over the top, then add the rest of the sauce. Sprinkle with the remaining cheddar, the breadcrumbs and parmesan.
Cover the dish with foil and bake until the potatoes are just tender, 35 to 40 minutes. Uncover and bake until the top is browned and bubbly, 15 to 20 more minutes. Let sit 10 minutes before serving.