SQLite Forum

set/get last_insert_rowid - To mutex or not mutex?
Login
The "last inserted rowid" is only valid in "single thread per connection" environments. No mutex is required to read memory written by the same thread.

The function documentation specifically states that multithread interference may cause sqlite3_last_insert_rowid() to return garbage if another thread is performing an INSERT on the same connection while the function is running.