First, when it starts to thunder let the dog in the house but do not comfort them while they are hiding. Instead, call them out of hiding and give them lots of rewards and praise when they come to you.
Another idea is to get a tape of thunder, start playing the tape low, letting the pet get comfortable with the sounds of thunder. Slowly, over time turn the volume up. With time and patience, most dogs will get over this fear of thunder.