Preheat the oven to 375°F (190°C).
Boil the potato cubes in salted water until just tender, about 10–12 minutes. Drain and set aside.
In a skillet, heat olive oil and sauté the diced onion until translucent. Add garlic and cook for 30 seconds more. Set aside.
In the same pan, melt butter, then whisk in flour to make a roux. Slowly pour in the cream, stirring constantly until smooth and thickened.
Stir in the mozzarella, Parmesan, salt, black pepper, red pepper or paprika, and thyme. Mix until the cheese is fully melted and the sauce is creamy.
In a large bowl, gently combine the boiled potatoes, sautéed onions, green onions, and the cheese sauce. Beat the eggs and stir them in.
Transfer the mixture into a greased baking dish and bake for 25–30 minutes or until golden and bubbly on top.
Let rest for 5–10 minutes before serving.