In a case that offers new meaning to the phrase “dumb luck,” one grumbling gambler is being accused of losing all his money at a Colma casino, failing his attempt to rob a woman who won big at that casino and wrecking his mom’s car — all in a matter of hours, prosecutors from the San Mateo County District Attorney’s office said.

Giovanni Salazar, 23, allegedly ran out of cash at Lucky Chances Casino on Aug. 9 and got greedy when he noticed a more fortunate 54-year-old San Jose woman cashing out $8,000 in chips, they said.

Police say Salazar followed the woman to the parking garage, trailed her in his car until Hillside Drive in South San Francisco, and “intentionally rear-ended” her car when she heeded to a stop sign.

At first, the alleged crook acted like it was an accidental fender bender, cops said. But when he began to exchange insurance information

with the woman, he tried to snag her purse, South San Francisco police said.

The victim said she fought back and was “thrown to the roadway,” suffering cuts and torn clothing, police said. Still, she fended him off and — once again — won big, they said.

The suspect fled. But remember, this clever victim was keen on playing the numbers, prosecutors said. Cops said she jotted down the license plate information of her attacker’s car, which authorities said belonged to Salazar’s mother.

With that, detectives said they tracked him down to his Burlingame residence and scored the bust, prosecutors said.

The casino said its cameras recorded footage of Salazar following the victim as she left with her winnings, prosecutors said.

Salazar was in custody on $50,000 bail, and is scheduled to be arraigned Aug. 22, prosecutors said.