Add butter, sliced onions, and garlic to a frying pan and place over medium heat.
Saute for 5 minutes or until onions and garlic are soft. Set aside.
Peel and thinly slice the potatoes.
In a bowl, whisk together the cream, milk, mustard, and salt and pepper. Set aside.
Layer ¼ of the potatoes into the base of a medium-sized baking dish. Next, alternate layers of onions, diced ham, and more potato slices, finishing off with a final layer of potatoes and any remaining ham sprinkled on top.
Pour cream mixture over the top.
Top with grated Gruyère.
Cover with foil and bake for 1 ½ hours.
In the last 20 minutes of cooking, remove the foil and continue to bake until golden and crisp.