Heat the oil in a large skillet over medium-high heat. Add the onions, thyme, ½ teaspoon salt, and ¼ teaspoon pepper. Cook, stirring occasionally, until the onions are golden and tender, 13 to 15 minutes. Stir in the vinegar and sugar. Serve warm or at room temperature.