Grease the baking dish with a pat of butter or another solid fat, and sprinkle it with breadcrumbs. Gently tap the dish on the work surface to remove any excess breadcrumbs.
Peel and press the garlic cloves.
Cook the pasta in salted water until tender, then drain. Follow the manufacturer's instructions on the packaging.
While the pasta is cooking, dice the ham into 1/3-inch (0,7 cm) pieces. Heat a skillet over medium-high heat and let a knob of butter melt in it.
Add the ham cubes and cook, stirring constantly, until their edges begin to brown. This will take about three to five minutes.
Pour the milk and cream into a large enough container. Add the eggs and beat them with a hand whisk until a creamy, yellowish mixture forms.
In a large bowl, combine the hot, drained pasta with the fried ham. Season with salt and pepper, and add the pressed garlic. Mix well. Finally, pour in the milk and egg mixture. Stir again thoroughly.
Carefully transfer the mixture into the prepared baking dish, smoothing the surface evenly.
Preheat the oven to 325°F (170°C), using the top and bottom heat, not the fan-forced circulation. Place the pan on the middle rack and bake for 30 minutes. Then turn off the oven without opening it, and leave the casserole sit in the oven for another 15 minutes to finish cooking.