My car had this exact issue and it turned out to be a failing engine ECU.
While mine is the C30 D3 I believe the V50 ECU is in the same location and suffers the same issue.
Water gets in the housing for the ECU and rots it. Luckily my car was under warranty so Volvo replaced the ECU and modified the housing to stop water collecting in it.
Picture of ECU location on a V50 (same as C30 location) and two screenshots of the diagnostic video Volvo sent me showing the corrosion to my ECU and corrosion from the ECU in the plastic housing... Hope this helps.