Preheat oven to 375 degrees. Warm oil in a skillet over medium heat and add onions and a pinch of salt and pepper. Sauté until tender and lightly golden, about 6 to 8 minutes. Add garlic and sauté until fragrant, about 2 minutes.
Transfer onion and garlic on the bottom of an 11 x 9 gratin dish or a 10-inch round baking dish. Overlap potatoes, tomatoes and squash over the onion mixture. Season with salt (I use about ½ teaspoon) and pepper. Sprinkle with thyme and Pecorino/Parmesan and drizzle with olive oil.
Cover and bake for 30 minutes. Uncover and bake another 30 minutes until golden and potatoes are tender. You can serve this hot, warm or at room temperature.