Place the rinsed beans in a large pot and cover with water by 2 inches. Bring to a boil, then remove from heat and let soak for 1 hour. Drain and rinse.
In the same pot, heat olive oil over medium heat. Add onion, garlic, carrots, and celery; cook until softened, about 5 minutes.
Add the ham hock or diced ham, broth, water, bay leaf, thyme, and black pepper. Bring to a boil.
Stir in the drained beans and tomatoes. Reduce heat to low, cover, and simmer for 1.5 to 2 hours, until beans are tender.
Remove the ham hock, if using. Let cool slightly, then shred the meat, discarding bone and fat. Return meat to the pot.
Season with salt to taste. Remove bay leaf before serving.
Tips
For a vegetarian version, omit ham and use vegetable broth.
Serve with crusty bread or cornbread.
Store leftovers in the refrigerator for up to 5 days or freeze for up to 3 months.