Hi.. the gifts operate as He (holy Spirit) moves. There is no such gift as discernment. Discerning of spirits is a gift yet it can't be used to discern when something is "out of wack." So discerning of spirits is the same as seeing or hearing in the realm of the spirits.
As a believer in Jesus Christ there is nothing that has more power then Christ in you so nothing has the right to control you. Me I just take authority over that thought. The classic say fear.. no I don't receive that for its written God has not give me the spirit of fear but of power love and a sound mind. In Phil "Finally, brethren, whatever things are true, whatever things are noble, whatever things are just, whatever things are pure, whatever things are lovely, whatever things are of good report, if there is any virtue and if there is anything praiseworthy—meditate on these things."
Now

heres something for you I truly believe this. I can't remember that last time I thought or remembered this verse yet it just popped up in my head Isa 26:3 "You will keep him (Sofiahh) in perfect peace, Whose mind is stayed on You, Because he trusts in You."
Praise GOD glory to JESUS.. that is for you. Also for me it was sleeping and bad dreams but I would read every night before bed Psa 4. I still do to this day and those dreams have never come back. So you resist those thoughts tell them to go in JESUS name. Peter and John though it was about healing yet it applies here also. After the man was healed they said why do you look at us as if we did this by our own power. That name faith in that name Healed that man.
So you speak that name.. even those thoughts have to come in to order so to speak. Now me I would repent .. thats to make sure there is nothing between me and Him and then just ask Him. See when He talks its always with peace love never fear worry doubt. The fruits of the spirit "love, joy, peace, patience, kindness, goodness, faithfulness, gentleness and self-control." Again nothing has the right to control you. Growing up lol always heard and its TRUE the mind is Satans play ground. Praying for you.