Rain and thunderstorms are expected across Massachusetts early Thursday morning, with localized flash flooding possible in parts of Western Massachusetts.