A 33-year-old man was killed and three other people – including rapper Troy Ave — wounded when gunfire erupted shortly before the start of a concert by rapper T.I. at Irving Plaza Wednesday night, sources said.

The carnage began in the green room of the Union Square venue at about 10 p.m. while the opening act — rappers Maino and Uncle Murda — were performing, according to law-enforcement sources.

The gunplay then spilled into the area near the stage, causing panic among more than 1,000 rap fans packed into the music hall.

“There were people blocking each other using each other as shields,” said Kirk Elphage, who was on the scene. “I was in the front of the stage . . . I was just trying to find an exit to get the hell out.”

Among the victims was the acclaimed Brooklyn rapper Troy Ave, whose real name is Roland Collins, 30, the first person shot, a source said.

He was hit in the leg as he entered the green room and went by himself to NYU Langone Medical Center, where he was in stable condition, sources said.

Some said he may have been planning to take part in the show.

Ronald McPhatter, 33, was shot in the stomach and was declared dead at Beth Israel Hospital, a source said. Christopher Vinson, 34, was shot in the chest and taken to Bellevue, sources said.

Maggie Heckstall, 26, who was shot in the leg, was recovering at Bellevue, where she was visited by rapper 50 Cent.

“I’m here to support my friend, his girl was shot,” 50 Cent told the Post. “What’s happened here is not good.”

The mayhem began after a fight erupted in a limited-access section on the seventh floor — before spreading to the second floor, where the shooting took place outside the green room, a police source said.

More than 1,000 people where in the house at the time, including rapper T.I., the source said.

Police Commissioner Bill Bratton said Thursday morning that investigators have a “pretty good idea” of what happened.

“We feel we’ll wrap it up very quickly,” the top cop said on WCBS 880. “The crazy world of the so-called rap artists who are basically thugs that basically celebrate the violence…and unfortunately that violence often times manifests itself during their performances and that’s exactly what happened last evening.”

As people fled the room, the gunman also exited and started firing again, the source said.

“We were standing around waiting for T.I. to come on,” said Rachael Pietrocola, of Harlem. “We heard gunshots and everybody started running.”

A witness said that the shooting happened shortly after T.I. left the green room.

“Two VIP rooms right next to each other,” the witness said. “T.I. leaves the VIP room before the shooting happened. Whatever went down, he had nothing to do with it.”

It was not immediately clear what triggered the attack. The gunman was still at large early Thursday.

McPhatter has a rap sheet including charges of assault, marijuana possession, criminal trespass, resisting arrest and aggravated unlicensed operation.

Vinson’s arrest record includes charges of criminal possession of a controlled substance, weapons possession, assault and aggravated unlicensed operation.

The Atlanta-based T.I., whose real name is Clifford Harris Jr., has been in trouble in the past. He was sentenced to a year in prison after a 2007 arrest on federal gun charges, according to CNN. After his arrest, he appeared on the MTV reality show, “T.I.’s Road to Redemption.”

The rap star has been nominated for a Grammy Award nine times and won twice. Among his hits are the 2008 songs “Whatever You Like” and “Live Your Life,” both of which went to number one on the Billboard charts.

Additional reporting by Melissa Klein and Natalie Musumeci