Thanks for your patience.
Just to touch on the hesitation starting before getting into it, note that this would be unrelated to the fault codes. These codes will not cause any hard starting at all, at worst just poor acceleration from a stop, coughing, etc. If you are having a hard time starting it, the majority of the time this will be a leaky fuel pressure regulator; another super common failure on this model.
The air monitoring on this vehicle is a bit unique compared to most cars as the MAF is used as a test device against the two boost sensors, and vice versa. Because of this any failure on either can cause a fault on the other... sometimes solely on the other.
It is extremely often that we will see a P0101 (MAF sensor) and the only
fault, but the failure point is actually boost #1 (manifold) sensor.
On a normal car the MAF sensor reads the volume of air coming in and the computer uses this to determine the fueling amount as it reads the air volume.
This occurs on the S40, however it also uses the dual boost sensors to calculate air volume actually inside the manifold/piping.
By reading the pressure from boost sensor 2 on the intercooler and comparing it against the atmospheric reading on boost sensor 1 on the manifold, it can calculate the approximate air volume inside the manifold and piping. If it knows the atmospheric pressure, and it knows the compressed pressure, it can determine how much air volume would fit at that compression reading, at that altitude (atmospheric reading).
This is a bit unique of a situation in itself.... most turbocharged vehicles will just have a single MAP sensor... but on top of that, this calculation is then cross checked against the MAF reading to make sure the air volume entering corresponds with the air volume observed.
The result here is that you can have one boost sensor skewing slightly which will cause an erroneous volume calculation that will cross check against the MAF incorrectly. The go-to response for the computer when this occurs is P0101, MAF fault. This is because the computer is not smart enough to realize one of the boost sensors failed unless it reads a completely implausible reading (40 psi at idle for example). If it is just skewed (reading 8 inHg instead of 17inHg for example), it will assume it is a valid number since it is plausible, then it will fail on the cross check with the MAF.... and again, the go-to response here is a MAF failure, even though in description we can clearly understand it is not.
The reverse can hold true as well, that a MAF reading error can cause erroneous boost sensor faults, it is extremely rare though.
It sounds like you've been more or less on the right path here. The odds of it not
being a boost sensor are pretty low, however we wouldn't know if you fixed it unless you cleared the faults and they did not return (boost sensor faults normally return the second or third time you drive the car).
Your P0107 again was for the intercooler boost sensor, however remember that a skewing of sensor readings can/will result in trouble codes... meaning that you may have a boost #2 that is working perfectly and boost #1 is reading incorrectly causing #2 to appear wrong. Yes, it's a mess of a system.
The best thing to do here first before even buying anything is to check for vacuum leaks throughout.... this means injector seals, manifold gaskets, intercooler piping/couplers, and especially the idle hose between the throttle and the intercooler.
If you have a vacuum leak affecting your pressure readings, you will get erroneous fault codes.
If no areas of concern are found, take the two boost sensors and reverse them, then clear the faults... the majority of the time you will find either the situation corrected, the situation significantly changed (drivability betters/worsens), or a change in what codes you see. These are all tell tale signs that you have one boost sensor failed. At that point it is ideal to replace both (they both are just as old as each other), however you can try one as you've done and re-evaluate.
With a new sensor in the intercooler (again since that is the fault being thrown), you would clear the fault and drive the car.... if the vehicle does not fall on it's face on throttle from a stop, and/or the codes do not return, you should be good.
If it stumbles badly on throttle and/or the codes return (same or different), you would swap the new sensor to boost #1 and reinstall the original boost #2 on the intercooler.
If there is still no change, then and only then would we consider the MAF as a plausible cause. It is always the least likely scenario especially if you are seeing boost sensor faults too.
At that point you can remove the MAF and try some MAF cleaner or brake
cleaner to clean it out, let it dry, and retry..... it is usually beyond that if it is failed though.
I can tell you from years of working on the S40/V40 I have seen maybe one or two MAF failures, but I have had to have changed at least a hundred or more boost sensors. They are a known weak point as well as a very difficult failure to diagnose if you aren't familiar with the backwards system they use.
Before doing anything else, however, you need to clear your faults and see what returns. Waiting for the light to go out can take a very long time, whereas the fault returning if the problem isn't fixed will only take minutes (a couple < 1 mile drives).
Since you already have the one sensor, put it back in the #2 position and have the fault cleared and see whats up... if it returns, swap it to #1 position (remembering to put the original #2 back in place not move the #1 there since we wouldn't be eliminating it that way), then clear the faults and try again. If you have identical behavior/codes in both situations and you have no vacuum leaks, then and only then would you consider a MAF as a possibility.