For the caramelized onions: Melt the butter in a medium saute pan over medium heat. Add the onions and sugar and cook, stirring occasionally, over low heat until soft and caramelized, about 30 minutes. Stir in a few tablespoons of vinegar and cook for 1 minute longer. Add the thyme and season with salt and pepper. For the buckwheat crepes: Combine the milk, 3/4 cup water, the flours, oil, salt, pepper and eggs in a blender and blend until smooth. Cover and refrigerate for 2 hours and up to 8 hours. The longer it sits, the more tender the crepes. Preheat the oven to 350 degrees F. Brush a crepe pan or 8- to 10-inch nonstick pan with some of the melted butter and heat over medium heat until it begins to sizzle. Lift the pan at a slight angle and pour 1/4 cup of the batter into the center, tilting the pan to spread the batter to the edges. Return the pan to the heat and cook until the crepe is golden underneath, 1 to 2 minutes. Using a spatula, flip the crepe over and cook until golden on the other side, 1 to 2 minutes more. Transfer to a plate and cover. Repeat with more butter as needed and the remaining batter. For assembling the crepes: Return a crepe to the warm pan. Spread some onions over the surface, scatter some grated cheese over the onions, and tear a ham slice and drop across the surface. Fold the crepe in half, then in half again to make a triangle, and heat through to melt the cheese. Serve.