Place navy beans in a colander, rinse them well with cold water and allow to drain. Pick through the beans and remove and discard any debris.
Add oil to the Instant Pot and press the SAUTE button. When display reads "Hot" add the onion, carrot, and celery. Cook, stirring, for 4 to 5 minutes, or until onion and veggies begin to soften. Add garlic and cook for an additional minute then press CANCEL.
Add beans, broth, water, thyme, cumin, cayenne, and the bay leaves. Stir well to combine. Tuck the ham shank (or meaty ham bone) down into the mixture. Lock the lid in place and make sure vent is sealed (on older models). Press the MANUAL or the PRESSURE COOK button, select HIGH, and cook for 40 minutes.
When time is up, allow the steam pressure to naturally release for 15 minutes then manually release any remaining pressure. Unlock and remove the lid. Transfer ham shank (or bone) to a cutting board. Use a fork to remove the ham from the bone and stir it into the soup. Discard the bone.
If a creamier (less brothy) texture is desired, pulse the mixture with an immersion blender 3 or 4 times, just to break up some of the beans. Don't go overboard, you want lots of whole beans and a few pulses will yield a nice and creamy result. I highly recommend not skipping this step.