Check the tune with TuneECU at or near that rpm in both F and L tables. It is not difficult to in-advertently enter or erase data in a cell or two. (Don't ask how I know that.) Engine will hit that spot and all goes awry. If it stumbles and won't recover when held right at that rpm, this is the first thing to check.
If you can't find an anomaly by looking, the bad data can be in tables you don't have access to, so a change of tunes may be in order.
If there is a bad memory cluster in the ECU ram, over-writing the tune with a different tune (stock or other) and then re-loading the tune you had in may resolve the issue.
There is no mechanical reason that the engine would have a problem in 3rd and 4th gears only and then only at 4,000rpm and at all throttle positions and acceleration rates.