Salt the cucumber first. Put the cucumber slices in a small bowl, toss with 1/4 teaspoon salt, and set aside for 10 minutes. Squeeze the slices gently with your hands and pat dry before using.
Cook the carrot briefly. Bring a medium pot of salted water to a boil. Add the carrot and cook 1 to 2 minutes, until just tender at the edges but still firm in the center. Lift it out with a slotted spoon and spread it on a plate to cool. Keep the water boiling for the potatoes.
Boil the potatoes until just tender. Add the potato chunks to the same pot. Cook 10 to 12 minutes, until a knife slides in with slight resistance. Drain well and return them to the warm, empty pot for 1 minute to steam off surface water.
Season and mash while hot. While the potatoes are still steaming, sprinkle the vinegar, sugar, and 3/4 teaspoon salt over them. Mash about half of the potatoes with a potato masher or large fork, leaving the rest in soft chunks.
Cool before the mayo goes in. Spread the potatoes in a wide bowl and let them cool 10 minutes, until warm but no longer steaming.
Fold everything together. Add the squeezed cucumber, carrot, ham, onion, mayonnaise, black pepper, and mustard if using. Fold gently with a spatula so the chunks stay intact. Taste and add salt or another spoonful of mayo if it seems dry.
Chill, then taste again. Cover and refrigerate at least 30 minutes, or up to overnight. Taste again before serving and add a pinch of salt or a few drops of vinegar if it needs lift.