The rescue of a puppy was caught on camera Wednesday, and the adorable happy ending has gone viral online. The Ferguson Fire Department in Missouri responded a call about a 5-week-old puppy stuck upside down about 20 feet underground in a narrow drain pipe.

"At approximately 3:45 PM Ferguson Firefighters were dispatched to the scene of a puppy trapped in a pipe. When Firefighters arrived they found the puppy inverted in a 8 inch pipe about 20ft underground," the fire department wrote in a Facebook post that accompanied the video.

Today at approximately 3:45 PM Ferguson Firefighters were dispatched to the scene of a puppy trapped in a pipe. When Firefighters arrived they found the puppy inverted in a 8 inch pipe about 20ft underground. Crews from Ladder 3025 and Engine 3014 worked to extricate the puppy utilizing a series of ropes. We are happy to report that the puppy was removed and returned to his relieved owner. Posted by Ferguson Fire Department on Wednesday, May 16, 2018

The misadventure apparently happened a day after someone ran over a drain pipe in the yard with a lawn mower, leaving a gaping hole big enough for the puppy to fall through, the St. Louis Post-Dispatch reports.

Get Breaking News Delivered to Your Inbox

Crews used a series of ropes to pull the puppy out. While the fire department worked to free the puppy, a concerned little boy watched form his porch. He was the puppy's owner, terrified for his beloved pet.

When firefighters finally got the puppy out of the pipe, he was unharmed and they were able to immediately turn him over to his owner. "We got him out and got him some water and he started running around again. The little boy was thrilled that we got his dog out," Ferguson Assistant Fire Chief Randy Skaggs said.