Heat oven to 300 degrees and generously butter a shallow gratin dish. Heat butter in a large skillet over medium-low heat. Add onions and a pinch of salt and cook, covered, stirring occasionally for about 10 minutes, until translucent but not coloured. Remove the lid from the pan and increase the heat, cooking until golden brown. Stir in the thyme and white wine and cook for another 5 minutes then transfer to a bowl.
Peel potatoes and slice them thinly using a mandoline. Do the same with the apples, removing any seeds.
Combine potatoes, apples, and onion mixture in a large bowl. Season well and gently mix to combine. Mix the milk and cream together in a bowl. Transfer potatoes and apples to prepared baking dish, spreading evenly. Pour over the milk and cream mixture and dot with the blue cheese. Sprinkle over a little more thyme and a good amount of black pepper.
Cover dish with parchment paper, then cover with foil. Bake gratin until potatoes are tender, about 55 minutes. Uncover and bake until the top browns, about 20 minutes longer.