Preheat the oven to 350 degrees F (175 degrees C). Grease a 9x13-inch baking dish with softened butter.
Toss potato slices and chopped onions with salt and pepper; spread 1/3 of the potato mixture into the prepared baking dish. Sprinkle half of the Gruyère cheese over potatoes, then add another layer of potatoes. Sprinkle on remaining Gruyère cheese, then layer remaining potatoes on top. Mix water and wine together; pour over potatoes in the dish. Cover the dish with aluminum foil.
Bake in the preheated oven until potatoes are tender, about 1 hour 15 minutes. Remove foil and pour cream evenly over potatoes. Bake, uncovered, for an additional 15 minutes to thicken cream and brown the top.