SAN JOSE — Alert gym staffers helped unravel a crafty South Bay auto-burglary scheme where the culprits sneaked into area gyms, rifled through lockers and used electronic key fobs to locate and steal cars in the parking lots while their owners worked out, authorities said.

In just over three weeks of an investigation that at times resembled a cat-and-mouse caper, the suspects, part of a purported crew composed of area transients, were also linked to home burglaries and identity thefts in South San Jose and South Santa Clara County. Those crimes were similarly thwarted by alert and enterprising victims who turned the tables on the thieves.

“It’s a collaborative effort,” said San Jose police Sgt. Ken Davis, who led the investigation. “We can’t have eyes on the community 24/7, so we need the residents and community to provide us information. Then we can see certain trends that occur, and allocate resources to knock that out.”

So far, five cars have been recovered and three men are in custody, though police are looking for more.

The elaborate ploy all began to fall apart on May 3, when two men were seen acting suspiciously at the South Valley Family YMCA on Santa Teresa Boulevard. One of the men purportedly distracted the front desk staffers while the second went into a restroom.

Suspicious employees started watching the men, which scared them off, Executive Director Rick Valdez said.

But moments later, a gym member rushed in to report that her Honda minivan had been stolen from the parking lot. That prompted the staffers to review their surveillance video, which captured clear images of the men and the vehicle leaving the property.

Valdez reported the theft to police and also contacted Davis, a 19-year SJPD veteran who works for the Regional Auto Theft Task Force, a unit run out of the Santa Clara County Sheriff’s Office that employs officers from several police agencies in the county.

The gym director also alerted other area YMCA locations to keep an eye out for similar activity.

“I took those still pics and sent them to the other branches,” Valdez said.

Lo and behold, later that same day, one of the men from the first theft, accompanied by a different accomplice, tried to do the same thing at a YMCA branch on Quito Road. Already on the alert, staffers there confronted the men and scared them off, but not before video cameras again captured their movements.

Soon afterward, a Morgan Hill detective working on the task force recognized the man seen in both appearances as 24-year-old Colby Worsham, and the accomplice in the first, South Valley incident as Anthony Roberts, also 24.

The task force staked out places where they suspected stolen vehicles might turn up throughout South San Jose, and two weeks after the first case, they arrested another suspect, 24-year-old Richard Higgerson. He was booked and released on his own recognizance.

But he wasn’t free for long.

As investigators continued building their case, thefts with a similar pattern started to pile up. Within a week of the May 3 thefts, two other gyms in South San Jose were hit. Then one in North San Jose.

Meanwhile, in another case linked to the crew, someone broke into a car outside Oakridge Mall, took some keys for another car, and used mail inside to go to the owner’s home and steal that other car.

In the gym cases, Davis said, the thieves got the keys to the cars they stole by ransacking lockers that were unlocked, breaking through locks, or sneakily watching over gym members’ shoulders while they set temporary combinations for day lockers.

But the men apparently became careless, and the evidence snowballed. Police said an associate of the men tried to cash a check stolen from the first minivan, and when another was caught driving a stolen car, police found a stolen credit card.

Another stolen credit card was traced to a home burglary in Almaden Valley, and the homeowner figured out that the thief used it to have something delivered. So he gave police the name and address on the order.

Worsham was arrested Tuesday, and Roberts and Higgerson were arrested the same day. With Roberts, police found the wallet, driver’s license and credit card of a man whose car was burglarized near the Uvas Reservoir outside Morgan Hill.

Police believe the suspects are all transient, which made tracking them difficult. Davis said Higgerson was found with a cardboard sign made for panhandling, reading, “Homeless Hungry Any Help’s Appreciated Thank You God Bless Anything Green OK.”

Davis said a California Highway Patrol officer and an investigator from the District Attorney’s Office working on his team were crucial to solving the case, the latter spotting Worsham. Also working on the case were detectives from Milpitas, Los Altos and Mountain View.

Worsham — who Davis said has a history of committing similar crimes — Roberts and Higgerson are being held in the Santa Clara County Jail. But he believes there are more people involved in the theft ring.

“I’ve never been so proud of my unit more than in this particular case, as far as involving the community and different agencies,” Davis said. “It’s a comfort to know that RATTF is having an impact, however so slight, in safeguarding the community’s property.”

Valdez, the YMCA manager, lauded his employees for their alertness and authorities for their thorough follow-up.

“It’s nice to know they weren’t going to give up,” he said. “This is just like our home. They broke in and stole something from us. It feels great we were able to get these guys.”

Contact Robert Salonga at 408-920-5002. Follow him at Twitter.com/robertsalonga.