In a large skillet over medium-low heat, cook the bacon, stirring occasionally, until crisped, about 10 to 12 minutes. Use a slotted spoon to transfer the bacon to a large bowl.
Add the ham and heat, stirring occasionally, until browned, 3 or 4 minutes. Use a slotted spoon to transfer to the bowl with the bacon.
Now add the onion, salt, and pepper to the skillet and cook, stirring occasionally, until soft, approximately 3 or 4 minutes.
Reduce the heat to very low and cook, stirring occasionally, until the onion is golden brown and very tender, 12 to 14 minutes. Transfer the onion to the bowl with the bacon and ham and set aside to cool.
Meanwhile, preheat oven to 350 degrees F. Place the pie shell on a rimmed baking sheet and bake until the pastry is pale gold along the rim, 20 to 25 minutes.
Add the cream, eggs, and nutmeg to the bowl with the bacon, ham, and onion, whisking to combine.
Remove the shell from the oven (leave the oven on). Pour the cream mixture into the shell and arrange the asparagus on top, if using. Bake until the tart is golden and a knife inserted into the center comes out clean, 45 to 50 minutes.