Prepare the ingredients before beginning. Shred the Gruyère, separate the ham slices, measure the milk, and arrange the bread on a clean work surface.
Make the mornay sauce. Melt 1 tablespoon butter in a small saucepan over medium heat.
Add the flour and whisk continuously until it forms a thick, bubbling paste, approximately 30 to 60 seconds. Do not allow the flour to brown deeply.
Slowly pour in a small amount of the milk while whisking continuously until smooth.
Gradually add the remaining milk, continuing to whisk and scraping the bottom and corners of the saucepan.
Increase the heat to medium-high and bring the mixture just to a boil while stirring constantly.
Reduce the heat to medium-low and simmer, stirring regularly, until the sauce thickens enough to coat the back of a spoon, approximately 1 to 2 minutes.
Remove the saucepan from the heat.
Stir 1 ounce shredded Gruyère into the sauce until completely melted and smooth.
Season with freshly ground black pepper. Taste before adding salt because the Gruyère and ham are already salty.
Cover the saucepan and keep the mornay warm over very low heat while assembling the sandwiches.
Spread one side of each sourdough slice with 1/2 tablespoon softened butter.
Arrange the bread buttered-side down on the work surface.
Spread 1 teaspoon Dijon mustard over each of two bread slices.
Spread approximately 2 tablespoons warm mornay sauce over the mustard on each slice.
Top each prepared slice with 2 slices ham and 1 ounce shredded Gruyère.
Close each sandwich with one remaining bread slice, keeping the buttered sides facing outward.
Preheat the oven broiler to high and position an oven rack approximately 6 inches below the heating element.
Place the sandwiches in a large skillet over medium heat.
Toast for 2 to 3 minutes per side, pressing only lightly if needed, until both sides are golden and the cheese inside begins to melt.
Transfer the toasted sandwiches to a rimmed baking sheet.
Spread approximately 1/4 cup warm mornay sauce over the top of each sandwich.
Place the baking sheet beneath the broiler.
Broil for 1 to 2 minutes, watching constantly, until the sauce is bubbling and develops light golden-brown spots.
Remove the sandwiches from the oven and transfer them to serving plates.
Carefully crack each egg into a separate small bowl.
Wipe out the skillet and melt the remaining 1 tablespoon butter over medium heat.
Gently slide the eggs into separate sides of the skillet.
Season lightly with kosher salt.
Cook undisturbed until the whites are set and the yolks reach your preferred doneness, approximately 3 minutes for a soft yolk.
For firmer whites without flipping, cover the skillet briefly during the final portion of cooking.
Season the eggs with freshly ground black pepper.
Use a flexible spatula to place one fried egg on top of each sandwich.
Serve immediately while the sandwiches, mornay sauce, and eggs are hot.