Using a mandolin or a sharp knife, thinly slice the potatoes lengthwise.
In a 13-inch (33-cm) cast iron skillet, layer slices of potatoes around the outside of the pan. Add another layer of potatoes, keeping them centered in the pan and moving clockwise until the pan is covered.
Top with a third of the cheddar cheese, a third of the Gruyère cheese, and half of the ham.
Add another layer of potato slices around the outside of the pan, then a add layer of slices around the center of the pan. Top with another third of the cheddar and Gruyère and the remaining ham slices.
Add a final layer of potato slices around the center of the pan
Top with the remaining cheddar and Gruyère cheese.
Cover with greased aluminum foil and bake for 40 minutes.
Remove the pan from the oven and increase the oven temperature to 400˚F (200˚C).
In a medium bowl, combine the flour, garlic, Parmesan, salt, pepper and mix well.
Slowly add in the cream, whisking until fully incorporated.
Uncover the skillet and pour the cream mixture over potatoes, spreading evenly.
Bake for another 10-15 minutes uncovered, until the cheese is melted and golden brown.
Cool for at least 30 minutes, then slice and serve.