https://github.com/mysqljs/mysql #obteniendo-el-id-de-una-fila-insertada describe la solución perfectamente bien:
connection.query('INSERT INTO posts SET ?', {title: 'test'}, function(err, result, fields) {
if (err) throw err;
console.log(result.insertId);
});