Pre- heat oven to 350° F.
Preheat skillet, then add butter, followed by onions, garlic and thyme.
Sauté for about a minute or more until fragrant. Be careful not to let the garlic burn.
Pour in cream, and milk followed by salt, pepper, and nutmeg.
Bring the cream mixture to a boil and simmer over medium heat, stirring occasionally for about 5 minutes. Remove from heat and let it cool down a little.
You may discard the onions and thyme (optional; use a sieve for this process). Transfer cream mixture in to a Dutch oven.
Add sliced potatoes into the creamy mixture. Cover Dutch oven adjust, heat temperature to a simmer. Cook for about 10-15 minutes until potatoes are almost tender when pierced with fork.
Then transfer to a baking dish, add ham in between layers, sprinkle with cheese and top with more ham, if desired. Bake until potato mixture is bubbling around sides and the top is golden brown.
Let it cool, slightly before serving.