Two gay men were savagely beaten last week in Philadelphia's Center City district by a group of 10-15 "clean-cut, well-dressed" people in their twenties. With only a blurry security video to go on, finding the attackers would have been a long shot were it not for Twitter, Facebook and the viral spread of a cheesy restaurant photo.

According to Philadelphia police, someone in the group subjected the men to "disparaging remarks about their sexual orientation". In the ensuing confrontation, the victims were held down and attacked, receiving punches to the face, head and body. One of the gang grabbed a victim's bag–containing a cellphone, wallet and credit cards. As police approached, the group fled.

Both of the victims were taken to hospital and treated for multiple injuries: one sustained fractures so severe he required facial surgery and had his jaw wired shut.

The police put the video out on YouTube, however, and it soon spread to Twitter, where one Greg Bennett tweeted it. He soon linked to a photograph, taken at a restaurant, which showed the same group of people mugging for a camera. Though it had no accompanying information, the coincidences were many: the same blandly expensive check shirt, the same schoolboy shorts, the same ill-fitting red vest. It was clearly the same group.

The photo, he said, came from "a friend of a friend of a friend", who'd sent him it after he posted the CCTV footage: "I wanted to get the word out."

The revealing shot spread like a virus, getting retweeted 476 times. Within hours the restaurant was identified as La Viola, a nearby Italian BYOB place, by another Twitter user, FanSince09. And he wasn't finished: having identified the location, he checked Facebook's advanced search–which lets the user narrow the graph to specific locations and times–to see if anyone had checked in with photos or postings at that venue.

Bingo.

Now armed with pictures and names, police thanked the sleuth–on Twitter, of course–but warned that there'd be much work to do: its not, they wrote, "a Law and Order episode."

Yet within hours, reports emerged that those "well dressed" suspects had already lawyered up and were talking to police.

The sequence of tweets that led to their apprehension is storified by Melody Kramer. For his part, FanSince09 has advice for would-be scumbags: