It depends on more than just where the peaks are, the shape of the power and torque curves are important. If the peak torque was at 4,000rpm, but then there was a plateau at just under that for another couple of thousand revs then you wouldn't want to change up that early.
I struggle with the relationship between power and torque, but as I understand it torque is more important for acceleration.
In practical terms (not worrying my pretty head with the theory) it is usually where you end up in the rev range after changing up that is more important. If you change up at 4,000rpm then you are going to find yourself fairly low in the rev range when you get to the next gear. The result of this on many engines is that you will find yourself in a range with low power and torque, thus slowing you progress.
On my MX5/Miata it is fastest if I hang on to nearer 7,000rpm (rev limiter at 7,200) even though the power and torque starts to fall off, because that puts me in a better place in the power and torque curves for the next gear.
Almost all my experience is from smallish four cylinder petrol engines. I suspect things are different with big V8 and diesel engines, where you can have huge amounts of torque low down in the rev range.
_________________________
Remind me to change my signature to something more interesting someday