The case of the dead sheep

Solution 1:

Lightning has a certain range of damage, no matter how many blocks are in between. The only way to protect your sheep against that is placing a block a lot higher up, for example 10 blocks higher should be safe. Lightning only ever strikes the top block in a column (except when summoned by a command).

There is also a bug allowing mobs to hit or shoot through corners, so in theory a skeleton with a Flame bow could have tried to shoot something else and accidentally shot exactly the corner of your sheep pen. But that is so incredibly unlikely that we can safely assume that it was lightning.