There is some question as to how to interpret Ecclesiastes 7:3, but when read with Proverbs 14:13, the strangeness of the proverb makes some sense:
Even in laughter the heart may ache, and the end of joy may be grief.
Sorrow is better than laughter, for by sadness of face the heart is made glad.
The depth of this relationship becomes even more profound when one considers also the paradox of joy and sorrow noted by Peter:
6 In this you rejoice, though now for a little while, if necessary, you have been grieved by various trials, 7 so that the tested genuineness of your faith-more precious than gold that perishes though it is tested by fire-may be found to result in praise and glory and honor at the revelation of Jesus Christ. 8 Though you have not seen him, you love him. Though you do not now see him, you believe in him and rejoice with joy that is inexpressible and filled with glory, 9 obtaining the outcome of your faith, the salvation of your souls.
1 Peter 1:6-9. Tim Keller in in a wonderful sermon “Born Into Hope” (http://sermons2.redeemer.com/sermons/born-hope), notes that the joy of the Christian which is utterly independent of present circumstances, because it is based upon a living, future hope, gives us the capacity to actually experience sorrow without fear. One without hope can only seek to rescue himself from sorrow lest he become destroyed. But the Christian’s hope gives us the expansiveness to know sorrow without despair.
At the beginning of 1 Thessalonians, Paul notes that the church received the word of The Lord with affliction and joy:
6 And you became imitators of us and of the Lord, for you received the word in much affliction, with the joy of the Holy Spirit, 7 so that you became an example to all the believers in Macedonia and in Achaia.
1 Thessalonians 1:6-7. Since their joy was not dependent upon their context, it could not — and for the Christian who understands this well, cannot — be taken, even when sorrow comes and grieves the heart. Thus, even death, the greatest of all sorrows and losses becomes transformed:
13 But we do not want you to be uninformed, brothers, about those who are asleep, that you may not grieve as others do who have no hope. 14 For since we believe that Jesus died and rose again, even so, through Jesus, God will bring with him those who have fallen asleep. 15 For this we declare to you by a word from the Lord, that we who are alive, who are left until the coming of the Lord, will not precede those who have fallen asleep. 16 For the Lord himself will descend from heaven with a cry of command, with the voice of an archangel, and with the sound of the trumpet of God. And the dead in Christ will rise first. 17 Then we who are alive, who are left, will be caught up together with them in the clouds to meet the Lord in the air, and so we will always be with the Lord. 18 Therefore encourage one another with these words.
1 Thessalonians 4:13-18