Preheat the oven to 375°F. In a large saucepan, melt 4 tablespoons butter over medium heat. Stir in the flour, dried parsley flakes, salt, dried thyme and pepper until smooth. Gradually add the milk. Bring the mixture to a boil. Cook and stir for two minutes.
In a large bowl, combine the sliced potatoes, chopped ham and grated onion. Place half of the mixture in a greased 2-½-quart baking dish. Top with half of the sauce. Repeat the layers.
Cover and bake until the potatoes are almost tender, 65 to 75 minutes. Uncover the dish, and dot it with the remaining 2 tablespoons butter. Bake, uncovered, until the potatoes are tender, 15 to 20 minutes.