Saute onion and bacon in a large pan until onion is soft.
Add wine and cook until evaporated.
Add potato cubes and cook until tender, about 15 minutes. If mixture becomes too dry during cooking, add a little bit of water to it.
Season to taste with salt, black pepper and dry thyme. Add cream and heat for 1 minute.
Transfer half of the mixture into a greased casserole dish (4-cups volume). Sprinkle with half of the grated cheese. Repeat with remaining potato and cheese. Bake in 350 F (175 C) preheated oven for about 30 minutes or until golden and bubbling.