Never doubt a dog's heart.

Whether it's a bump in the night — intruder?! — or a leap into the breach to restore forests ravaged by wildfire, dogs rush in.

And all that canine courage, even if occasionally foolhardy, is rightly celebrated.

But there's an underrated quality that dogs possess: the everyday heroism of just appearing at your side, almost instinctively, when you're in distress.

Want to test it? Try crying, and see how long it takes for your dog to sidle up next to you.

In fact, for a study published this week in the journal Learning & Behavior, that's exactly what researchers from Johns Hopkins University did. They pretended to be trapped behind a door — and then alternated between crying and humming "Twinkle Twinkle Little Star."

Even in the lab, a dog's empathy shines through

Although it seems that we've always been sure that our dogs are emotionally tuned into us, this study represents the first time that empathy has been clinically tested.

And the dogs didn't let down researchers, either.

When scientists were seemingly trapped behind a door that was magnetically locked, their cries of distress brought the test dogs over in a hurry. In fact, the dogs hustled to the scene three times faster when they heard the cries, then they did when researchers hummed "Twinkle, Twinkle Little Star."

"It's really cool for us to know that dogs are so sensitive to human emotional states," study co-author Emily Sanford, from Johns Hopkins University, explains in a press release. "It is interesting to think that all these anecdotes of dogs rescuing humans, they could be grounded in truth, and this study is a step toward understanding how those kinds of mechanisms work."

Sad man hugging dog Dogs in the study were stressed out, but they kept their emotions in check and focused on the problem. (Photo: Sjale/Shutterstock)

What's more, the dogs demonstrated an uncanny knack for suppressing their emotions when there was a life-saving job to be done. Although their stress levels spiked when they heard crying behind the door, dogs managed to master their emotions and quietly, efficiently push it open with their nose.

A minority of the test dogs, however, did show a very human response: Their stress levels were so high that they were effectively too paralyzed to help.

Sure, it isn't the biggest study — researchers looked at just 34 dogs — but it does confirm what we've always known in our hearts from living with dogs: dogs get us.

That's because, the researchers suggest, they've been studying the human heart for a very long time.

The Lassie effect

"Dogs have been by the side of humans for tens of thousands of years and they've learned to read our social cues," Sanford explains in the release. "Dog owners can tell that their dogs sense their feelings. Our findings reinforce that idea, and show that, like Lassie, dogs who know their people are in trouble might spring into action."

Like earlier this year, for instance, when a corgi named Cora suddenly walked away from her human companion at the airport. She was found a few minutes later, perched at the side of a stranger.

It turned out that stranger was grieving the loss of his own dog the night before.

Now, how to explain those dogs who run for their lives when strangers pretend to break into the family home?

Maybe they're smart enough to know when we're faking it? Or maybe, at some point, the situation seemed so dire and extreme, those dogs just had to high-tail it out of there.

But we prefer another theory: The dogs were just going to get help.

Stray dog looking under door Dogs are keen students of humanity — and they've evolved to read our emotional states. (Photo: Gansstock/Shutterstock)

Dogs know when we're sad — and rush to help
A new study finds dogs rush in — but stay calm — when they hear their human crying.