First, we'll make the crust. Add the flour, salt, and sugar in a medium bowl. Cut the butter into small cubes and add to the flour mixture. Use your hands (or a pastry blender) to combine the two until the butter is the size of small crumbs.
Mix egg yolk and water together in a small bowl. Make a well in the flour and butter mixture and add the egg yolk mixture to the well. Use a fork to gently combine the mixture together. Once combined, use your hands to form mixture into a disk. If the mixture is too crumbly to come together, add a little more water. Wrap disk in plastic wrap and freeze for 20 minutes. In the meantime, start the filling.
Add 1 1/2 tablespoons olive oil and onions to a medium skillet. Turn heat to medium and begin to cook onions until they are translucent, about 10 minutes. Add diced ham and continue to cook for another 10 minutes. Stir occasionally. Remove from heat and set aside. Preheat oven to 375 degrees.
After crust has chilled in the freezer for 20 minutes, place on floured surface and begin rolling into a large circle, about 1/8 inch thick. Using a 2.75-inch round cutter, cut out 24 circles. Keep in mind, you will probably need to roll out the scraps from the first batch in order to get 24 rounds.
Grease a mini-muffin tin with non-stick spray. Place each circle over a mini muffin mold and press it completely in the mold using your fingers or a shot glass. Push crust up the edges of the mold. My muffin tin has 24 molds so I could fit them all into one pan. But if your mold only holds 12, you'll have to do two batches. Place tin back in the freezer while we prepare the rest of the filling.
Whisk eggs until they become frothy. Add cream, salt, and pepper and whisk together. Pull the muffin tin from the freezer. Grab the ham and onion mixture and place a little in the bottom of each muffin mold. Be careful not to overfill or you won't be able to add any of the egg mixture.
Fill each muffin mold to the top with the egg mixture. I find it much easier to do this with a bowl or measuring cup that has a spout. Once all molds are filled, top each one with 1/2 teaspoon of shredded gruyere cheese.
Place quiche into prepared oven and bake for about 20 minutes. The quiche will get really puffy and the cheese edges will get crispy. Remove from oven and let them cool in the pan for 10 minutes. Remove from pan and place on plate to cool for another few minutes before eating. Serve warm or at room temperature.