There should be about 1/2 cup of the shredded cheese. In a large saucepan, soak the beans overnight in the water. (Or bring to boiling, simmer for 2 minutes, cover and let stand for 1 hour.) Do not drain. Add the 1/4-cup of onion, garlic, and the 1 tsp of salt. Cook for another 2 hours or until very tender. Combine the UNDRAINED tomatoes, the 2 tablespoons of chopped onion, 1/2 tsp of salt and cayenne. Set aside. Heat the 2 tablespoons of vegetable oil in a large heavy skillet. Add the beans with the liquid. Mash the beans in the skillet. Cook uncovered over medium heat 3 to 5 minutes or until very thick. Cook peas according to the directions on the package and drain. Toss with the ham; cover and keep warm. Heat 1/4 inch of vegetable oil in another heavy skillet. Fry tortillas 20 to 40 seconds per side or until crisp and golden. Drain on paper toweling. Spread about 1/3 cup of the bean mixture on each tortilla and keep them warm in a 300 degree F oven. In the same oil fry the eggs until they are set. Season it with the salt and pepper. Place an egg on the top of each bean-covered tortilla. Sprinkle each with about 1/2 cup of the ham mixture. Spoon some of the tomato sauce on top and sprinkle with the cheese. Serve hot.