does teeth cavity couser discomfort in the heart
I would explain as follows:
Welcome on Ask a Doctor service!
Regarding your concern, I would explain that in general teeth problems may reflect also on cardiovascular health. These issues may lead to proinflammatory state and atherosclerosis progression.
But, this is true only for advanced and chronic teeth inflammation, not just cavity.
I'd recommend taking care of any teeth inflammation/infection in order to timely prevent further progression.
Wishing you good health!