A lawyer tied up his roommate in their upscale Queens apartment and tried to force him at gunpoint to liquidate his stocks — only to be killed when the man escaped and bashed him in the head with a hammer, sources said.

Quentin Capobianco, 18, told cops he turned the tables on Jesse Smith, 29, after being held captive for eight hours in a money dispute.

Smith was trying to force Capobianco to liquidate some stocks to reimburse him for damages to a wall and furniture that were caused by a mishap with their wall-mounted fireplace.

Capobianco, who was being held with zip ties, managed to free himself and make a break from his shotgun-wielding roomie, sources said.

Police recovered a bloody hammer and a shotgun from the scene.

Smith was rushed to Elmhurst Hospital, where he was pronounced dead. Capobianco was charged with murder and criminal possession of a weapon, police said.

Smith had been living in the Astoria apartment alone until about five months ago, when he took Capobianco in to help cover some of the costs, neighbors said.

He had to cut back when he left a high-paying job to strike out on his own, a source said.

“He was starting a new business,” said Tony Wang, 31, a clerk in City Sliquors, a liquor store where Smith bought champagne to celebrate new clients.

“He said he was not going to work for someone else anymore, he was only going to work for himself,” he said.

Neighbors said Smith was happy in the luxury Exo building at 26-38 21st St., where one-bedroom apartments rent for as much as $2,800, and amenities include a fitness center and a rooftop deck.

“When I saw him out on the street not too long after Christmas, he said he was renewing his contract at [the Exo building],” Wang said. “He liked that building.”