RAW: no, this would not work.
Remember that spells only do what they say they do. The description of the Locate Object spell 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, [...]. Alternatively, the spell can locate the nearest object of a particular kind, such as a certain kind of apparel, jewelry, furniture, tool, or weapon.
[...]
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 were 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.
However, your DM may rule otherwise because it's clever and cool.
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, Ia DM might "rule of cool" that your suggested use of the spell mightcould 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. then I'm personally disinclined to rule as such.
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.