Apollo, the Greek deity of the sun and the arts, once competed in a music competition with a lesser river spiritnote Other versions talk instead of a satyr named Marsyas. When Apollo found out that he couldn't beat the river spirit, he challenged the river spirit to do an impossible task: play on a flute and sing at the same time. When said deity couldn't do that, Apollo announced himself to be the winner, and ordered the challenger to be skinned alive. In some myths, King Midas called him on his total jackassery (others, he simply voted for the other guy until Apollo did the Moving the Goalposts bit), but Apollo just gave him donkey ears to shut him up.
The point of the whole story, meanwhile, might have been that you don't enter contests where being flayed alive is the stake and the other guy is a god.
Or that you shouldn't go around saying you're better than a really powerful diety.
In The Epic of Gilgamesh, Shamash calls Enkidu out for cursing Shamhat, the hooker who introduced civilization to Enkidu, because of the grief it eventually cost him with the Bull of Heaven mess. Enkidu relents and instead offers a blessing for Shamhat.
It gets better. God—via Nathan—tells David a story about a rich man who killed a neighbor's pet sheep for his dinner despite having a large flock of his own. (David had several wives at the time.) David is furious and decrees that the rich man should die, and four sheep of his flock should be given to the wronged neighbor. In a brilliantly delivered Twist Ending, God essentially gets David to call himself out.
David: As the LORD liveth, the man that hath done this thing shall surely die: And he shall restore the lamb fourfold, because he did this thing, and because he had no pity.
Nathan: Thou art the man!
In the Book of Daniel, King Nebuchadnezzer of Babylon does a lot of stupid things, including threatening his seers with death unless they completed an impossible task and building a giant statue, forcing people to worship it, and attempting to kill 3 of his official who wouldn't, because they were Jewish. Both times, God sorts out the problem, and Nebuchadnezzer appears to have been converted so God lets him off. Then he breaks his promise one day by looking over his kingdom and calling himself God. So Daniel shows up to inform him that his punishment from God is that he will go insane for seven years and think he's an animal, which soon comes to pass.
The Book of Job has Job holding a whole What the Hell, Hero?court case over God's having apparently punished him without cause. Job's friends keep trying to convince him that he must have done something to deserve the punishment (of which he could therefore repent), while Job holds the line and insists on his day in court with God. Subverted in part in that God counters Job's charges, not by explaining that He had a bet with Satan, but by invoking something like an Omniscient Morality License. Ultimately, however, He does tell the friends that "You have not spoken rightly of me as Job has" and they are the ones who end up having to repent!
But Job was a faithful believer in the Resurrection of the Dead, so he rightly expected to be reunited with his dead children one day.
In support of the above, Job's property is restored double - twice as many oxen, camels, etc. as he had before - but his family is restored once over. This tends to suggest that his first ten children are still counted, and will be restored to him at the resurrection.
During the Last Supper, Peter says that he will follow Jesus even into death, if need be. Jesus responds that Peter will deny him three times that very day. Flash forward a few hours: while Jesus is on trial, some people recognize Peter as one of his followers. Forgetting all about the earlier conversation, Peter denies the he knows Jesus, with his denials becoming more and more emphatic each time he's asked. Immediately after the third such denial a rooster crows, and Jesus just turns and looks at him. Peter is so shamed by that look that he apparently gives up on Christianity altogether and goes back to his old life as a fisherman. He gets better, though.
Better enough for Jesus to apparently have made him the "rock" of Christianity, thus beginning the Church. Apparently the What the Hell Hero moment really did wonders on him.
In The Book of Mark, Jesus gives one to his disciples after they inform him that they commanded a man with the ability to exorcise evil spirits to stop because he was not a follower of Christ and tells them that as he was using his powers to do good deeds, they should see him as an ally and not an enemy.