Chop the thyme, reserving a few leaves for garnish. Place the thyme, cream, milk and garlic in a large pan. Bring to a simmer, then add the potatoes, cover and cook for 5 minutes. Stir in the bacon and onions and season with a little freshly ground black pepper. Place half the potato mixture in the bottom of the dish, then place half the sliced cheese over the potatoes. Repeat, finishing with a layer of cheese.