This might be a known bug as i didn't yet go through all the posts on the forums, so i am sorry if its redundant.
Here goes:
I was playing Yor at the time of the bug happening, turn 165. The terrans declared war on me and i decided to try out the Negotiator I perk in the pragmatic tree, which grants me immunity to declarations of war for 100 turns (which by the way seems quite a lot). The result was that i was still at war with the terrans but their diplomatic status didn't mirror that - in fact they were still willing to trade with me, and i purchased their whole fleet - during a war agains me mind you.
Please look into this.