Pour the lentils into a small bowl and cover with water. Set aside and allow the lentils to soak for two hours. Drain the lentils and set aside.
In a large pot, heat the olive oil over medium/low heat, then add the onion and sauté until golden. Add the celery and carrot and sauté for a few more minutes. Then add the garlic and sauté until fragrant. Add the lentils, potatoes (if you are using them), tomato paste, beef stock, and bay leaf. Cover and simmer for 30 minutes or until the lentils are soft.
Remove the bay leaf, add the diced ham and return the soup to a slow simmer. Remove from the heat, add the red wine vinegar and salt and pepper to taste.
Serve over spätzle or simply by itself.