Cook macaroni in boiling salted water according to package directions. Drain well.
Place warm macaroni in a large bowl; toss with 2 tablespoons vinegar.
Stir in cubed cheese, ham, peas, and onion. Set aside to let noodles absorb the vinegar.
Prepare dressing in a separate smaller bowl: Whisk together mayonnaise, 1 tablespoon vinegar, sugar, salt, and pepper.
Pour over the macaroni mixture and stir until well combined.
Cover and chill for at least an hour before serving. Or, chill overnight to allow the flavors to fully meld.