Yes they are dangerous, but generally it's not too hard to avoid them. Solitary males in musth are often said to be the most dangerous. However, I would anytime choose a male over a herd. Males are often solitary. If there is only one, avoiding is relatively easy.
Meeting a herd in the jungle is scary. Elephants can be extremely quiet, more quiet than most people hiking in the jungle.
Seeing one could mean there are many spread around, and if you end up to be in the middle, praying like the biker in Khao Yai, might be your only option (or climb a big tree...)
Most of the time the elephants know you are there. Their hearing is a lot better than ours, and so is their sense of smell. And if you are outside their comfort zone they are OK.
If you are too close the ears will go out and stop clapping. This is the first sign they are aware of your presence and it usually means that you need to back off.
If you don't leave or even get closer, they might charge. Though sometimes they run off.
If you do get charged, running away is the best you can do. Get out of its comfort zone. Yes, elephants are fast, but not faster than a human with adrenaline rush!
Standing your ground is not recommendable. It does work sometimes. I have once been cornered by a bull, so had no other option but to stand my ground, while he was no more than 4 - 5 m away from me where it stopped and watched me. Due to dense bushes I was not able to run. And I was simply lucky to meet the right elephant at the right day. Otherwise it could have been my last day...
This case, the charge came as a total surprise because besides us, another group of hikers turned up on the other side of the elephant. We had already been there for a while watching it. The elephant knew we were there, but he was OK with that. It continued browsing and the ears were happily flapping. But when the other group suddenly arrived from his other side, he must have felt surrounded and that freaked him out so without any warning he started charging towards us!
It all happened too quickly, so I can't recall exactly, but I guess because my fellow group members who were in front of me did not run fast enough for my liking, I took a turn off the trail, and that turned out to be a bad choice as I ended up in dense bushes.
Lesson learned. There are other factors that could suddenly scare the animal and get you in danger. So always be prepared!
But besides this experience which happened in one of my first years in Thailand, all my encounters after that have been without problems. Just keep your distance. Watch the signs, and keep in mind the possibility of the 'external factors'.
The animals that worry me the most are the bears.
Though, night walking in tiger habitat is also quite scary. Still, in daytime I guess you might be better off meeting a tiger than a bear.
But, knock on wood, all my bear encounters have been without any trouble. But the bears often seem to act totally fearless. I would not want to meet a big Asian Black Bear mommy with two cubs...
I have yet to meet a tiger on foot. Surely I will have shaky legs for an hour or longer if that ever happens.
I had one close encounter with a leopard in Kaeng krachan, earlier this year, where it was standing 30m away from me. But it just slowly walked off.
I might be wrong, but I have never heard of Leopard attacks in Thailand.
In the end, with Thailand being number two in the world with most traffic deaths, I think you are more likely to get killed while driving to a national park, then while spending your days inside these parks.
Just use common sense.