Matthew 27:33-46: "33 And when they came to a place called Golgotha (which means Place of a Skull), 34 they offered him wine to drink, mixed with gall, but when he tasted it, he would not drink it. 35 And when they had crucified him, they divided his garments among them by casting lots. 36 Then they sat down and kept watch over him there. 37 And over his head they put the charge against him, which read, 'This is Jesus, the King of the Jews.' 38 Then two robbers were crucified with him, one on the right and one on the left. 39 And those who passed by derided him, wagging their heads 40 and saying, 'You who would destroy the temple and rebuild it in three days, save yourself! If you are the Son of God, come down from the cross.' 41 So also the chief priests, with the scribes and elders, mocked him, saying, 42 'He saved others; he cannot save himself. He is the King of Israel; let him come down now from the cross, and we will believe in him. 43 He trusts in God; let God deliver him now, if he desires him. For he said, "I am the Son of God."' 44 And the robbers who were crucified with him also reviled him in the same way."
1 Corinthians 15:57: "But thanks be to God, who gives us the victory through our Lord Jesus Christ."
Isaiah 53:5: "But he was wounded for our transgressions; he was crushed for our iniquities; upon him was the chastisement that brought us peace, and with his stripes we are healed."
1 Peter 2:24: "He himself bore our sins in his body on the tree, that we might die to sin and live to righteousness. By his wounds you have been healed."
+++
The text is public domain:
Christ, the life of all the living,
Christ, the death of death, our foe,
Who, Thyself for me once giving
To the darkest depths of woe:
Through Thy suff'rings, death, and merit
I eternal life inherit.
Thousand, thousand thanks shall be,
Dearest Jesus, unto Thee.
Thou, ah! Thou, hast taken on Thee
Bonds and stripes, a cruel rod;
Pain and scorn were heaped upon Thee,
O Thou sinless Son of God!
Thus didst Thou my soul deliver
From the bonds of sin forever.
Thousand, thousand thanks shall be,
Dearest Jesus, unto Thee.
Thou hast borne the smiting only
That my wounds might all be whole;
Thou hast suffered, sad and lonely,
Rest to give my weary soul;
Yea, the cure of God enduring,
Blessing unto me securing.
Thousand, thousand thanks shall be,
Dearest Jesus, unto Thee.
Heartless scoffers did surround Thee,
Treating Thee with shameful scorn
And with piercing thorns they crowned Thee.
All disgrace Thou, Lord, hast borne,
That as Thine Thou mightest own me
And with heav'nly glory crown me.
Thousand, thousand thanks shall be,
Dearest Jesus, unto Thee.
Thou hast suffered men to bruise Thee,
That from pain I might be free;
Falsely did Thy foes accuse Thee;
Thence I gain security;
Comfortless Thy soul did languish
Me to comfort in my anguish.
Thousand, thousand thanks shall be,
Dearest Jesus, unto Thee.
Thou hast suffered great affliction
And hast borne it patiently,
Even death by crucifixion,
Fully to atone for me;
Thou didst choose to be tormented
That my doom should be prevented.
Thousand, thousand thanks shall be,
Dearest Jesus, unto Thee.
Then, for all that wrought my pardon,
For Thy sorrows deep and sore,
For Thine anguish in the Garden,
I will thank Thee evermore,
Thank Thee for Thy groaning, sighing,
For Thy bleeding and Thy dying,
For that last triumphant cry,
And shall praise Thee, Lord, on high.
+++
The text from Matthew is the main source, at least from a narrative point of view. The hymn is more concerned about the significance of these events, which the other texts explain.
The "thanks be to God" from 1 Corinthians 15:57 appears in the lines "Thousand, thousand thanks shall be, / Dearest Jesus, unto Thee" at the end of all but the last verse, although the last verse also includes lines about thanksgiving.
The exchange of "with his stripes we are healed" from Isaiah 53 and "by his wounds you have been healed" from 1 Peter appears throughout the hymn, but the hymn also elaborates on this. For example, the fourth verse says, "with piercing thorns they crowned Thee. ... That as Thine Thou mightest... with heav'nly glory crown me."