A plot by an architect to shoot up the high-end Soho design firm where he worked was foiled by a worried colleague who heard him make threats and saw him scrawl a map of potential victims, The Post has learned.

Would-be mass shooter Kon Jang hatched his revenge scheme after learning that the CetraRuddy firm was planning to fire him for his combustible, erratic behavior, law-enforcement sources said.

But the Korean native sunk his own plot by telling a female coworker — who was his only pal at the Broadway firm — that he had a gun and was “planning a mass shooting at work,” according to court papers.

The “loner” already told other coworkers “I’m going to come back here and you are going to get it,” the sources told The Post.

But his most chilling comments were made to one particular woman, in whom he thought he could confide.

Jang allegedly boasted that he “wanted to be on the news” and was planning a “tragedy,” according to a criminal complaint.

The comments prompted the woman to go to cops.

She told cops that she saw Jang draw a map of the office, putting red “Xs” where workers he hated sat. Around her seat, and his own, he put a circle.

The disturbed man was going to warn her not to come to work when he planned to carry out the alleged attack, the complaint said.

He had also asked about the time of the next meeting “where everyone from work would be together” — and said he’d “stay quiet until then,” court papers said.

When she confronted him about the creepy diagram, he “crumpled it up and put it in his pocket, telling her it was ‘nothing.’ ”

The 35-year-old was arrested on harassment charges on May 29 at his Wood-Ridge, NJ apartment — where cops discovered “what appears to be an assault rifle and rounds of fake ammunition,” according to the complaint.

Jang is being held in lieu of $10,000 bail. He surrendered his passport at a May 30 Manhattan criminal court arraignment. His next court appearance is June 16.

“He was very quiet. I never saw anything, I never would have guessed,” said a woman who works at CetraRuddy who declined to give her name.

“He kept to himself. He only really dealt with one girl,” she said.

Jang’s attorney, Kevin Morgan, did not immediately return a message seeking comment.

When reached by phone, a CetraRuddy employee, who did not give his name, said Jang “is no longer with the firm.”

Additional reporting by Antonio Antenucci