Does god know our thoughts? and is it a sin to have lustful thoughts?
Yes God knows as he is antaryami or one who resides inside us.
The Vedas say that the Brahman or God has entered our body and has established himself in the mind.
Shariram brahma prAvishat.
Brahman (or God) has entered our body.
Eko ha devo manasi pravishtah.
The sole God (or the one God) has established himself in the mind.
Also, even if we think that we are talking or thinking or doing something secretly there is always a divine witness who is observing everything. So, there is nothing which we can do or even think in mind which won't be noticed by God.
Dvau samnishadya yat mantrayete rAja tat veda varunah tritiyah .
When you talk in secret, there is always the third observer, divine observer Varuna.
As far as I know,lusting is one of the biggest sin a person can commit
No, that's wrong. Lust is innate in human and other beings as well. Its a natural pravritti that is born in humans everyday along with the other pravrittis like hunger, thirst, desire for sleep etc.
Sarire JAyayate Nityam VAnchah NrinAm ChaturvidhAHa | Vubhuksha Cha PipAsA SusupsA Cha RatisprihA ||
Daily these four-fold desires are born in a human body-hunger,thirst,desire for sleep and desire for sex (RatisprihA)
So, being lusty in itself is not a sin. Just like being hungry or feeling sleepy are not sins.
But, if afflicted by lust one cohabits with someone who's another person's wife then that is a sin. If you are hungry then that's natural order but if tormented by hunger you eat something that's forbidden in scriptures then that becomes a sin.
Abbreviations used :
AV 11.8.30 ------> Atharva Veda Samhita, KAnda 11, Sukta 8, Mantra 30 etc.
Note: “The question: Does god know our thoughts? and is it a sin to have lustful thoughts?” is licensed by Stack Exchange Inc (https://hinduism.stackexchange.com/); user contributions licensed under CC BY-SA.