Glad you have sorted the K40 and got rid of some faults.
I suspect there is an Engine Fault that your Torque is not seeing, and this may be communicating, (CAN Com Error) to BAS ESP, or could be vice versa, or maybe there is a fault in each system, but I'm going with communicated Errors right now, as the 2 events coincide !!
Car needs reading on a very decent bit of kit, I recommend SDS.
A little insight ..........
The cheaper the diagnostic kit the less codes / modules it will read.
I doubt Torque pro will read much more than a handful of Engine Codes.
SDS is the Dealer Machine, same software as used by Mercedes Main Dealers, it will access and do everything that the dealers can do, (well actually a clone machine with "Developer" enabled will do more than the Dealers can do) ................... Dealers do not have Developer Enabled, it is for factory R&D use only
SDS costs Ł400 upwards, but on R170 the basic Ł400 machine is all you need, perhaps an extra lead if your Car has the Round Pin Plug. AFAIK
Post Facelift Cars do not need this extra lead.
Anything that costs less than that will not get anywhere near SDS, and expensive professional machines which cost 5 times as much will still only get 80% of codes in 80% of Modules.
IMHO SDS is worth every penny for a serious DIY'er, everyone I have spoken with who has taken the plunge and bought SDS agrees, and it pays for itself many times over for lots of reasons.
HTH, Cheers Dave