Heat a large skillet. Add the olive oil. When it shimmers, add the onions and salt and cook over low heat, stirring occasionally, until the onions are deep golden in color, 45 minutes to I hour; add a little water if needed to prevent sticking. Add the vinegar during the last minute of cooking. Let cool.
Meanwhile, cook the bacon in a small skillet until it has rendered its fat. Using a slotted spoon, transfer the bacon to a paper-towel-lined plate; reserve the fat in the pan if you will be frying the shallots.
Let the bacon cool.
Stir together the mayonnaise, sour cream, onions, and bacon in a large bowl.
For the optional garnish, add the vegetable oil to the skillet with the bacon fat and heat over medium-high heat until the oil shimmers. Add the shallots, lower the heat, and cook, stirring occasionally, until golden brown, about 2 minutes. Drain the shallots on a paper-towel-lined plate.
Garnish the dip with the fried shallots, if using, and serve.