Police said the suspect, a career criminal named Kiet Than Ly, walked into the Smith's Marketplace at 455 East and 500 South and purchased a knife.
"The individual, for reasons that we don't know, went into the Smith's and bought a knife, came outside and attacked at least two people," said Salt Lake City Police Lt. Brian Purvis.
Distraught witnesses told FOX 13 they heard shouting in the parking lot and saw Ly, armed with a knife.
"I wasn't sure what was going on but as I saw a man walk away, there was lots of shouting and he had a knife in his hand," said one man, who did not give his name. "Apparently, the person who tried to get in the passenger side of the Subaru was a victim."
Police said Ly threatened to harm others with the knife, until a 47-year-old man with a concealed weapons permit pulled a handgun and ordered the suspect to the ground.
"When he saw the stabbing, he just drew his pistol and challenged the individual and turned him down on the ground," said Purvis. "He was subdued before any officers arrived."
The man held Ly at gunpoint until officers arrived and took him into custody.
"Obviously, this was a really volatile situation that could have gotten even worse. We can only assume, judging from what we saw it could have gotten a lot worse," Purvis said. "He was definitely in the right place at the right time."
Police and gun advocates are applauding the man for his quick thinking.
"I think the permit holder showed great restraint in not firing the firearm. This is an imminent, an immediate, on-going attack and if he believed that deadly force was necessary, he is perfectly justified in doing that," said W. Clark Aposhian, a longtime permit holder and gun advocate with the Utah Shooting Sports Council.
The victims, described as one man being in his 30s and another in his 40s, were rushed to the hospital and last reported to be in critical condition. Shoppers who parked in a lot at 600 East were not allowed to get to their cars while crime scene technicians took photographs and examined evidence.
"It could have been me five minutes earlier," said Danylle Julian. "I'm walking out to my car and there's blood splattered all over."
34-year-old Ly, who was born in Vietnam, had been released from jail earlier this week for charges of joyriding and possessing another person's ID. He has an extensive criminal history, sexual battery and lewdness. He has also been convicted for attempted assault against a police officer, theft and drug possession.