ubbthreads.inc.php there are 4 regexes..
#\[img\]([^?\['\"]+?)\.(gif|png|jpg|jpeg)\[/img\]# <-- 1st one
the "[^?" tells it to kill ?s.. so just change it to "[^" (remove the ?) and *poof* done.. note: do it on all 4 lines..
or.. you can just change your configuration to 'spider friendly' urls and the ?s will go away and you can link with no changes at all to your code..
example for this board below, like you posted:
that works because the url is of the form blabla.com/oioi/vey/teehee/doh/xxx.jpg vs blabla.com?ubb=oioi&vey=teehee&doh=xxx.jpg .. ok ?