Scrub and clean potatoes, then thinly slice potatoes into 1/8 inch thin slices. No need to peel potatoes. Set aside.
Pre-heat oven to 350 degrees F.
In a medium pot under medium heat, add butter. Once butter is melted, add diced onions and minced garlic. Sauté for 1-2 minute or until they are soft. Stir continuously. Avoid over-browning them.
Add flour and stir to combine. Once combined, add half and half, milk, chicken broth, thyme (see Note 1) and salt. Stir and bring to a boil. Continue stirring and cook for a minute or two, or until sauce thickens.
Turn off heat and add 1 cup of shredded cheddar and 1 cup of shredded mozzarella. Stir to combine. Remove thyme stems.
Taste to see if sauce is to your liking. Add more salt if necessary to open up the flavors even more. Remove from heat.
Grease a 12' oval dish or 9' x 13' rectangular dish. Add a very thin layer of cheese sauce to the bottom of the casserole dish.
Add 1/3 of the potatoes to casserole, spread the remaining 1/3 of the cheese sauce onto potatoes, then spread 1/2 of the ham onto the top of the cheese sauce. Avoid overlapping ham. (See Note 2)
Repeat Step 8 to create the second layer of potato/cheese sauce/ham. Then for the last layer, add the last 1/3 of the potatoes and the last 1/3 of cheese sauce. No ham in this last layer. Sprinkle the top with 1/2 cup of shredded mozzarella.
Place oven rack at the middle of the oven and place potato dish on the rack. For the second rack, place it at the bottom of the oven, and then place a cookie sheet on it to catch any drippings from the potato dish. Bake uncovered for 1 hour 30 minutes, or until potatoes are tender when you pierce the middle with a knife or fork. (See Note 3) If potatoes are still not tender, continue baking covered with aluminum foil until they are tender. At any point, even before the 1 hour 30 minute mark, if the top looks burned or over browned, cover with foil.
Remove and let it rest for 15 minutes. Serve and enjoy!