Preheat the oven to 325°F. Lightly butter a 3-quart shallow baking dish.
Heat a large pot over medium heat. Add the butter and stir until melted. Add the onions, garlic and thyme. and sauté for about 5 minutes, or until the onions are tender but have not taken on any color. Add the cauliflower and cook for about 6 minutes, stirring often, or until softened. Add the cream and milk, and bring to a simmer. Add the cheese and stir until it melts, then remove from the heat and discard the thyme stems.
Working in batches, purée the mixture in a blender; return to the pot. Season generously to taste with salt and pepper.
Stir the potato slices into the hot cream mixture to coat. Spoon 1 cup of the cream mixture into the baking dish. Spread the potatoes and the remaining cream mixture evenly in the dish. Cover with aluminum foil and put on a rimmed baking sheet. Bake for about 1 hour, or until a knife can be inserted easily into the potatoes. Uncover the dish, raise the oven temperature to 400°F, and continue baking for about 10 minutes, or until golden brown on top. Remove from the oven and let stand for 10-20 minutes.
Make-Ahead: The cauliflower-cream mixture can be made up to 1 day ahead, cooled, covered and refrigerated. Reheat over low heat before assembling the gratin.