Place the sugar, salt, and vinegar in the Mason jar and stir to dissolve. You can heat this in the microwave to speed the process up a bit.
Add the onions, garlic, and peppercorns to the jar; stir until evenly combined. Secure the lid tightly and store in the fridge. Your onions will be lightly pickled after a few hours, but they’ll taste even better the next day.