Pi's experience of nearly being electrified occurs in Chapter 85, which is when he recounts an amazing thunderstorm with one bolt of lightning in particular that comes dangerously close to striking him. Although the encounter is one of massive danger, and Richard Parker's response of visible fear is one that highlights this, Pi is caught up in a moment of ecstasy, because for him, the lightning storm "thrust me into a state of exalted wonder." This only intensifies after his close encounter with a lightning bolt. Note how he describes the experience:
I remember that close encounter with electrocution and third-degree burns as one of the few times during my ordeal when I felt genuine happiness.
Pi goes on to elaborate. He says he remembers this time as one of "geuine happiness" precisely because it was a "moment of wonder." During such times, it is easy to "avoid small thinking" about your lot in life. Instead you are caught up in "thoughts that span the universe." Pi remembers this time so happily therefore precisely because it gave him a sense of the divine and it allowed him to forget his situation. He glimpsed, however briefly, the might and power of God and this allowed him to contemplate life with "exalted wonder."