How to implement ORDER BY SUBSTRING in db_query
SelectQuery::orderBy() isn't particularly picky, you can just tack this on to the end of your code:

$query-&gt;orderBy('SUBSTRING(c.thread, 1, (LENGTH(c.thread) - 1))');


With the rest of your code that produces

SELECT n.nid AS nid, n.title AS title, n.uid AS uid, c.cid AS cid, c.pid AS pid, c.nid AS c_nid, c.uid AS c_uid, c.subject AS subject, c.comment AS comment, c.hostname AS hostname, c.timestamp AS timestamp, c.status AS status, c.format AS format, c.thread AS thread, c.name AS name, c.mail AS mail, c.homepage AS homepage
FROM 
{node} n
INNER JOIN {comments} c ON (n.nid=c.nid)
WHERE  ((n.type=:type)) 
ORDER BY SUBSTRING(c.thread, 1, (LENGTH(c.thread) - 1)) ASC