So John and Mary's wedding was a church wedding...I'm assuming Anglican but stop me if I'm wrong. If it is Anglican, I believe the tradition is that the beat man carries the rings. So on the wedding day, Sherlock was carrying the ring John bought for Mary. The ring that signified John choosing Mary over him, even after Sherlock pulled off just one more miracle and wasn't dead. The ring that was a tangible reminder of the life John chose--a very different life than what he had with Sherlock, so different than what Sherlock envisaged as he was getting ready to see John for the first time in a year and a half in TEH. And Sherlock was carrying the ring that John and/or Mary chose for John. The ring that signified the death of any chance he'd be Sherlock's alone, just the two of them against the world. The ring that was the outward sign John belonged to and with someone else. It's a testament to how much Sherlock changed and matures that he didn't just flush the rings, y'know? Instead he placed them on the minister's book solemnly and watched as John slipped one of those rings on Mary's finger, then watched her slip the other on John's finger, each of them vowing to love only the other for the rest of their lives. Somehow I think whatever torture Sherlock endured while he was tracking down Moriarty's network paled in comparison to this.