This is how you should do it and what works for me every time.
PHP Code:
$threaddm =& datamanager_init('Thread_FirstPost', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
$foruminfo['forumid'] = '2';
$foruminfo = fetch_foruminfo($foruminfo['forumid']);
$threadinfo = array();
$forumid = $foruminfo['forumid'];
$postuserid = $userid;
$userid = $userid;
$pagetext = $article;
$allowsmilie = '1';
$visible = '1';
$threaddm->set_info('forum', $foruminfo);
$threaddm->set_info('thread', $threadinfo);
$threaddm->setr('forumid', $forumid);
$threaddm->setr('userid', $userid);
$threaddm->setr('pagetext', $pagetext);
$threaddm->setr('title', $title);
$threaddm->set('allowsmilie', $allowsmilie);
$threaddm->set('visible', $visible);
$threaddm->pre_save();
if(count($threaddm->errors) < 1)
{
$threadid = $threaddm->save();
unset($threaddm);
build_thread_counters($threaddm);
}
build_forum_counters($foruminfo['forumid']);
EDIT: Removed the postuserid bit you had. That's not needed for a thread.
EDIT2: I also just relized you are using do_set(). You are not supposed to call that directly.