Preheat the oven to 350℉/177℃.
If using bacon, heat a large skillet and cook the bacon until crisp. Remove bacon from pan and set aside.
Drain the oil and leave about two tablespoons of bacon drippings in the skillet.
Then add butter, followed by onions, garlic, and thyme.
Sauté for a minute or more until fragrant. Be careful not to let the garlic burn.
Pour in the cream and milk, and add the 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 a little.
If desired, you can strain the sauce and discard the solids. Or just remove the sprig of thyme and transfer the cream mixture to a Dutch oven.
Add the sliced potatoes to the cream mixture. Cover the Dutch oven and simmer for 10-15 minutes or until potatoes are almost tender when pierced with a fork.
Then, transfer to a baking dish and sprinkle with cheese. Bake until the potato mixture bubbles around the edges and the top is golden brown. Remove and immediately sprinkle with bacon.
Let it cool slightly for easier serving.