Heat olive oil in a large pot over medium-high heat. Add in onions, carrots and celery and saute 4 minutes.
Add in bell pepper and garlic and saute 1 minute longer.
Add in chicken broth, sweet potatoes, basil and thyme and season with salt and pepper to taste (don't add too much salt as you'll be adding salty ham and cheese later on).
Bring mixture to a boil then reduce heat to medium-low and simmer until sweet potatoes and vegetables are tender, about 15 - 20 minutes.
Meanwhile, melt butter in a medium saucepan over medium heat. Add in flour and cook, whisking constantly, 1 minute.
Pour in milk into flour mixture, stir constantly and bring mixture to a light boil, remove from heat.
Stir ham and corn into soup (once veggies are tender) and heat through, about 2 minutes. Stir milk mixture into soup.