Whoops, my mistake. The link object requires special processing which is bypassed with the code I gave you. You should change the line
$this->sql_from = $this->_sqlForeignJoin($this->sql_select, $this->sql_from, $this->parent_relations);
to
$where_str = $this->_sqlAssembleWhere($where, $where_array);
This should generate the correct sql statement, which you can then modify.