BMW 528i 1996 E39 Ignition Problem

I've just bought the car (has done 83,000km) and everything is perfect execept the issue i'm having with the ignition. In the morning when I go to work it fires up with no problems, however as soon as the engine gets warm,
it takes up to 3-4 seconds to start it up again. Sometimes it kinda fires up but shuts down - then the 2nd time as I said it takes up to 4 second to fire up.... I took it to the mechanic and he replaced the crankshaft sensor which reported the fault but it still hasn't fixed it. Does anybody had a similar problem or any ideas what it might be? Much Appreciated.

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
Add image file
Upload is a website by car enthusiasts for car enthusiasts. It is not affiliated with any of the car or spare part manufacturers or car dealers discussed here. All logos and trade names are the property of their respective owners.