Two robberies were foiled in the city on Thursday when both suspects were struck and killed by a train while attempting to make their getaway, sources said.

One fatal incident took place in Brooklyn after a crook stole a cell phone while the other death occurred after a man robbed beer from a freight train in the Bronx, according to law enforcement sources.

The tragic turn-of-events began at around 4 p.m. when the cell phone crook robbed a Metro PCS store in Sheepshead Bay, sources said.

A Metro PCS employee gave chase as the 52-year-old thief ducked into a nearby Q Train station and boarded a northbound train.

But while running through subway cars, the bandit fell off the train and was crushed underneath it.

About an hour later, a second thief grabbed beer off of a freight train in Hunts Point, law-enforcement sources said.

As the 41-year-old man was running away he was hit and killed by a separate freight train, authorities said.

Police are investigating the circumstance behind both deaths.