Ok, here are a couple more thoughts. First, is there possibly another insert in your real code between the first insert and your call to last_insert_id? A side effect of some sub call maybe?
Second, you definitely should be able to see data you inserted during a transaction with a SELECT, even if the data is not committed yet, provided your queries are all coming from the same connection. That sounds very suspicious to me.