I actually wrote a fic a looooooooooooong time ago in which John gets shot (and eventually dies) and Sherlock has the breakdown of all breakdowns, including realizing that he loved John. So, it doesn't quite fit your entire prompt and it's far from my best work, but if you're interested, here's the link:
Possible RTYI?
http://archiveofourown.org/works/490148