Heat butter in a large skillet. Add onions and cook over medium-high heat, until the onions start to brown. Give them a stir occasionally.
Add 1/4 cup of the beef stock when the onions are a deep, rich brown. Reduce heat, continue cooking, adding more stock as needed to prevent caramelized bits at the bottom of the pan from burning. It takes a bit of time for the onions to caramelize - about 15 - 20 minutes. Rushing it will only produce burnt onions.
When the onions are caramelized, stir in the flour and cook for about 2 minutes, to cook out the "flour" taste.
Add wine (or beef broth) and simmer till it's reduced by half (about 10 min).
Stir in remaining beef broth, tomato paste, and cider vinegar; adding salt and pepper to suit your tastes. Then simmer for 10 - 15 minutes. The gravy will thicken as it cooks more.
Reduce heat to low and keep warm.