According to 汉典:
霹雳 (pīlì) mainly means thunderbolt as the atmospherical phenomenon.
sudden and loud thunder, it's the strong lightning bolt occurring between the clouds and earth
雷霆 (léitíng) mainly means thunderclap, as the booming sound of the thunderbolt, and it's also used figuratively. In English that would be thunderous.
booming and sudden thunder clap
describes metaphorically prestige or rage (thunderous, roaring)
In your examples, the two words look similar because of context:
Here it's definitely thunderclap, reinforced by the presence of 响, denoting a sound. (The usage of “一 yī” follows the "一 (yī) ～ 就 (jiù)" structure, events in quick sequence). "A thunderclap from the sky, ...".
Translating as "The thunderbolt" is not wrong, but that seems poetic license on the translator's part, which is fine, since the sentence can't be nicely translated word-for-word.
Here 霹雳 is preceded by 一声, which works as a classifier / measure word, and results in "one sound of thunderbolt". Therefore "I heard a clap of thunder."