Sed for replacing pattern

If I understand correctly, I think this is what you are looking for:

$ echo "This is the pattern : th_now(5), almost done!" | sed 's/th_now(\([^()]*\))/th_now_\1/'
This is the pattern : th_now_5, almost done!

Or:

$ echo "This is the pattern : th_now(5), almost done!" | sed 's/th_now(\([[:digit:]]*\))/th_now_\1/'
This is the pattern : th_now_5, almost done!