Keeping consistent market depth using Mt.Gox API
In my experience requesting the full market depth from MtGox, often results in flat out incorrect information. To deal with this I've resorted to constructing my own, in a similar manner as you described above. 

What I do is, using the websocket api, I look at all incoming depth events. I then keep two ordered arrays of bids and asks. On depth events if the volume is positive I add the order to the respective array based on the type_str property. If the volume is negative I remove the object from the array.

Make sure to combine objects of the same price, but with different volume. Likewise when removing objects if the negative volume is less then the volume of the same prices object then only deduct from the volume instead of removing. This is how it is done on MtGox's server and it will lead to errors if done differently. 

After letting this run for a little while, though not deep, the order book is quite accurate and representative of what the MtGox order book should be.