An e46 has a split tank with part of the tank on either side of the spare tire. There is only one fuel pickup, so a transfer pump has to move the last of the fuel from one side of the tank to the other. There are a couple of things that can go wrong with the transfer pump, but this is a common problem. If the car runs out of fuel when the gauge says you still have a quarter to a third of a tank, the problem is almost certainly the transfer pump.