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."