Usually this happens because you accuse the wrong person and kill someone who is not the spy. That said, I've had it fail on me before even when I was 100% certain I had the right guy (met all the clues given.) This has happened to me in all 3 patches so far, and I've given up on this quest at the moment. I think there's an issue with the clues given not always being right, and you pretty much just have to guess right or hope there's only one dude to accuse.