RAW, no this would not work. However...
...your DM may rule otherwise because it's clever and cool.
Remember that spells only do what they say they do, and Locate Object says:
Describe or name an object that is familiar to you. You sense the direction to the object's location, as long as that object is within 1,000 feet of you. If the object is in motion, you know the direction of its movement.
The spell can locate a specific object known to you, as long as you have seen it up close--within 30 feet--at least once. Alternatively, the spell can locate the nearest object of a particular kind, such as a certain kind of apparel, jewelry, furniture, tool, or weapon.
This spell can't locate an object if any thickness of lead, even a thin sheet, blocks a direct path between you and the object.
So we have to meet the conditions for the spell to work, and the big one here is object.
In D&D 5E, an object is explicitly defined as (emphasis mine):
...a discrete, inanimate item like a window, door, sword, book, table, chair, or stone, not a building or a vehicle that is composed of many other objects.
So even if the heart in question WAS an inanimate object (which it doesn't sound like it is), it might be hard to pull off since it's part of a greater whole (the NPC).
Using the spell the way you describe also undermines the 4th-level spell Locate Creature, which is explicitly intended to locate living things.
All that said, it seems like the scenario you find yourselves in lends itself to using the Locate Object spell in this way, and it may have been your DM's intention for you to do this. Depending on the circumstances, I might "rule of cool" that your suggested use of the spell might work, but I'd make the DC high, since we aren't meeting the various other conditions like the caster having seen the heart, etc.
IF the heart is separate, however, you might be able to pull this off, but your caster would still have to have a pretty good idea of what the object looks like.
So ultimately, it will come down to your DM, but RAW, no, this does not work if the heart is inside the NPC.
An example where this might work: if the heart is artificial, like made of stone, AND if your caster is familiar with it, it may be a valid target for this spell.