How do you know that the contents of one’s heart depends on the knowledge one has? That’s quite an assumption.
Why wouldn’t God know what is in one’s heart, even if that person did not know God? Isn’t that limiting God’s ability to know something, making man’s knowledge a prerequisite for God’s ability to know what is in a man’s heart?
The point is not what God knows — obviously, everything, — but how to change your heart. For that, as a general proposition, knowledge is necessary. Why is that a far assumption? — unless you meant the physiological heart as the blood organ.