In a 12-inch oven-safe skillet over medium heat, melt 2 tablespoons of the butter. Add the onion, seasoning with S&P as desired. Cook, stirring occasionally, until slightly softened, 2-3 minutes. Add the potatoes. Cook, stirring occasionally, until slightly softened but not cooked through, 4-5 minutes. Stir in the diced ham, then remove from the heat & set aside.
Add the remaining butter to a medium saucepan over medium-high heat. Once melted, add in the flour, whisking vigorously. Cook the roux for 1-2 minutes, stirring constantly, until golden brown. Slowly add the half & half into the pot, whisking constantly to eliminate any lumps. Stir in the sour cream & ham or chicken base, & season with S&P as desired. Cook 3-4 minutes, stirring occasionally, until thickened to the point that it coats the back of a spoon. Stir in ½ of the grated cheese. Once melted, remove from the heat & set aside.
Pour the cheese sauce over the potatoes & ham, stirring to combine well. Sprinkle the remaining grated cheese over top. Transfer to the oven & bake for 30 minutes, or until the ham and potato casserole is bubbling & the cheese appears well-melted. If desired, broil the ham and cheese casserole on the center rack for about 3-5 minutes, keeping a close eye on it as it broiled to make sure it doesn’t burn, until it’s as bubbly & golden brown as you like.
Fill in some text