Ages ago, when I had just joined the fandom, I read this fic. I can't recall if it was set directly post-Avengers; or if it was one of those fics where Loki never got captured at the end of the movie and goes on to occasionallly wreck havoc on Midgard.
In the fic, the Avengers team is somehow transported into Loki's mind (I think it might be one of those "magic gone awry" scenarios or something, but I'm not positive). Of course, his mind is an incredibly effed up place and they end up having to kind of experience his psyche for themselves. Like they encounter a younger, scared version of Loki and see some awful memories (I think they witness a younger Loki getting sexually assaulted). I'm pretty sure the way for them to get out is if Loki wakes up and helps like eject them from his conciousness, if that makes any sense? Either way, they go traipsing around and, at the very least, gain a better understanding of their enemy and realize that the situation isn't so black-and-white.
It's called "Nightmares that bind Us (I'll break them like glass)"