Thanks for the reply markusmarkus.
The car has a GM transmission. I have updated the software myself using ISTA-P through ICOM interface. I have access to ISTA-D and INPA as well and did scan the car, but there are no DME errors and the only EGS error was present was the one I described.
When I changed the oil I used proper Dexron fluid with Febi filter and filled it according to the specification (I believe it was aroiund 8l of fluid, since the torque converter was new and empty too).
Do you think that the wiring harness may cause such problems? All the sensors seam to work properly, according to INPA's live measurements.
Also, I went to see my mechanic friend that specializes in BMW and he thinks that the transmission is faulty. Since there are no transmission specialists in my country that can properly rebuild it, my only (very crappy) option seems to be to find a used one.
I believe I have read somewhere that a transmission from a 150hp 320d is the same as mine. In my head, these transmissions have to put up with far less torque and, if they are the same, it is more likely to find a good used one. Do you think this is an option?