A thunderous gas explosion rocked the East Village on Thursday, causing four buildings to become engulfed in flames, with two collapsing and a third in danger of falling down.

At least 19 people were injured — four critically — and one was missing after the 3:17 p.m. blast at 121 Second Ave., which was triggered by construction workers who accidentally ruptured a gas main in a ground-floor restaurant, sources told The Post. Four of the injured were firefighters.

The blast was heard blocks away, and acrid smoke from the blaze billowed north across Manhattan, where it could be smelled even in office towers in Midtown.

Mayor Bill de Blasio said, “The initial impact appears to have been caused by plumbing and gas work that was occurring inside 121 Second Avenue.”

The five-story tenement housed the Sushi Park restaurant on the ground floor. Sources said a customer there told cops he heard an explosion in the kitchen.

Day laborers told cops they had been working on a gas line there, a source said.

In addition to Sushi Park, the East Noodle ramen shop and popular late-night Belgian eatery Pommes Frites were destroyed.

FDNY Commissioner Daniel Nigro said firefighters arrived within three minutes and were stunned to see that the blast “blew the front of 121 across the street.”

The first responders searched the building for 15 minutes before it started to collapse, Nigro said.

Fire spread to adjacent buildings at 119, 123 and 125 Second Ave., with 123 collapsing and 121 partially collapsed, de Blasio said.

Nigro said 119 was “in danger of possible collapse” and about 250 firefighters would be at the seven-alarm site “for a very long night.”

Con Ed President Craig Ivey said utility workers were at 121 earlier in the day to check a new gas main that was being installed.

[theplatform account=”4uMbOC” media=”media/guid/2389494712/56AF13B9-F5CD-A2C8-2BFB-57D62237B208″ player=”Ud34RrXnH_qf”]

The work that had been done failed inspection, and gas service to the new, larger main was shut off in the building and “locked with our lock,” Ivey said.

Construction worker Matty Disilvestro, 51, of Sheepshead Bay, Brooklyn, said he was about a block north, on St. Marks Place, when the blast occurred.

“I heard a loud explosion, just a very loud, vibrating boom . . . People who were on the sidewalks and even people on the opposite side of the street were hit with debris,” he said. “People were bleeding from the head, the face, their hands.”

Tales of courage also emerged, with witnesses saying an off-duty firefighter sprang into action to help evacuate the building.

“He was going up the fire escape trying to get people out,” said Larry Gregory, 65, an actor who lives across the street. “He was knocking on windows saying, ‘Fire! Fire! Get out of the building!’ Incredibly brave man, because the building had just exploded.”

A three-minute video of the blast’s immediate aftermath shows an injured man flat on his back in the street, with another victim laid out on the sidewalk.

A man is heard yelling, “Yo, call an ambulance!” and a woman is seen climbing out a third-floor window onto a fire escape.

Robert Shapiro, who ran over from a cafe, said that, at first, “the whole building was covered in a thick, whitish-tan smoke. I assumed the building was gone, but it wasn’t; you just couldn’t see it.”

“Then, all of a sudden, the roof erupted in flames,” said Shapiro, who runs the Social Tees animal shelter around the corner on Fifth Street. “I swear to you, at least 30 feet in the air, bright orange flames. I’ve never seen such an aggressive fire. It was like they were pouring gas on it.”