A quick-thinking Texas man saved a dog from a horrible fate when its owner got onto an elevator while holding the dog's leash — without realizing the pooch had failed to follow her inside.

Johnny Mathis, of Houston, tweeted of the wild incident Monday, writing he was "shaking" after he heroically rescued the Pomeranian.

SAMMY THE DOG BARKS ALARM, SAVING GEORGIA FAMILY FROM FIRE INSIDE HOME

"I just saved a dog on a leash that didn’t make it onto the elevator with the owner before the door closed!" he wrote online. "I just happened to turn around as the door closed and it started to lift off the ground I got the leash off in time."

On Wednesday, he posted video footage of the encounter. It shows him getting off an elevator and a woman, who is walking her dog on a leash, getting on it.

COAST GUARD RESCUES FLORIDA DOG SPOTTED SWIMMING FOR ITS LFE

The dog either hesitates or isn't quick enough, and doesn't make it inside the elevator, separating the dog and the woman. The elevator doors close and the owner seemingly doesn't realize her dog is not inside with her.

Mathis sees what's unfolding and quickly jumps to save the dog. He runs and grabs the pet, pulling it down and trying to unbuckle it from its leash, which is now moving upwards as the elevator rises.

He eventually unclips the dog, picks it up and holds it in his arms before he stands, waiting for the owner to come back.

CLICK HERE TO GET THE FOX NEWS APP

“It was super scary and all I was focused on was getting that leash off the dog,” Mathis told Fox Television Stations. He said the owner was "terrified" and “as soon as the door shut she was screaming."

“There was nothing she could have done. She is new to the building so I think she wasn’t expecting it to shut so fast," he said. "I felt terrible for her. It was an honest mistake.”