Melt butter in a deep 12-inch saute pan over medium heat. Add onions and 1/4 teaspoon salt and cook for 30 to 40 minutes, stirring often, until deeply golden and soft; add up to 1/2 cup of the measured water a tablespoon at a time to loosen browning before it burns.
Push onions aside, add beef and cook for 7 to 8 minutes, breaking it finely and stirring it into the onions once browned, until the meat reaches 160°F. Spoon off excess fat.
Add thyme, pepper, remaining salt and broth and scrape the pan. Bring to a simmer and add broken spaghetti, separating the strands with tongs.
Cook uncovered over medium-low heat for 10 to 13 minutes until pasta is tender, lifting and stirring often. Use the remaining reserved water as needed to keep a shallow layer of sauce in the pan.
Remove from heat, stir in vinegar and wait 1 minute. Fold in Gruyere a small handful at a time until melted and serve promptly while the onion sauce is soft.