Heat the oven to 400°F. Heat a large skillet over medium heat, add the oil, and when it’s-hot, add the onions. Season well with salt and cook, stirring often, until the onions turn translucent and soften completely, about 10 min. Raise the heat to high and cook, stirring constantly, until the onions darken uniformly to a light brown, about 4 min. Carefully add the chicken broth (it will steam) and scrape the bottom of the pan to incorporate the browned bits into the broth. Remove from the heat.
Grease a 2-1/2-quart casserole dish (about 8x11 inches) with 1 Tbs. of the butter. Cut the remaining butter into 1/4-inch cubes. Peel the potatoes. Using a knife or a mandoline, cut the potatoes into disks about 1/8 to 1/16 inch thick. Arrange a layer of potatoes, slightly overlapping, on the bottom of the casserole dish, starting at one end of the dish and working to the other end in rows. Cover evenly with a third of the onions (use a slotted spoon), a third of the thyme, 1/4 tsp. of the salt, some pepper, and about 1-1/2 tsp. of the butter. Arrange two more layers of potatoes, onions, thyme, salt, pepper, and butter over the first. Pour the broth over this third layer. For the fourth and last layer, use the remaining potatoes and butter and sprinkle on the Gruyère and Parmigiano.
Pour the chicken broth over the potatoes, which are layered with browned onions, fresh thyme, and butter.
Neatly arrange a top layer of slightly overlapping potatoes. Sprinkle on the cheeses a nd butter, which will create a savory crust.
Bake until the top layer is golden brown, the potatoes are tender when pierced, and most of the broth has been absorbed (use a-knife to peek around the edges), about 50 min. Let the gratin cool for 20 min. before cutting and serving.