While onion is soaking, cook ham in a large nonstick skillet or sauté pan over medium-low heat about 6 minutes or until edges begin to curl and become crispy. Transfer ham to a plate.
In the same skillet or pan, heat oil over medium heat. Break eggs into skillet. Slightly break yolks with the tip of a sharp knife. Cover and cook about 3 minutes or just until whites are set and yolks are cooked, turning over halfway during cooking. Transfer eggs with ham on plate; cover to keep warm.
Meanwhile, drain onions and layer ham, mozzarella and onion slices on 1 slice of bread. Top with second slice of bread. Press down on sandwich with palm of your hand. Place in skillet and cook, covered, for 30 to 60 seconds on each side or until toasted.
Transfer sandwich to cutting board, and open sandwich. Layer greens and eggs on top; spread with pesto. Close sandwich and cut in half to serve.