Short answer
From the available evidence, it would appear that maybe as many as half of the (around 40) fatalities were passersby. This can be tentatively deduced from the likely number of non-passersby in the two carriages attacked. However, other police placed around side streets were also targeted by the Bolsheviks gunmen. The only named victims are the two bank officials.
Details
The most detailed accounts available of the attack in Yerevansky Square, Tiflis (Tbilisi) seem to be in Young Stalin by Simon Sebag Montefiori and Stalin: An Unknown Portrait by Mikl¢s Kun, who cite the Okhrana (Tsarist secret police) archives. Even in the archives, the number is only approximate, but Montefiori does have some of what you are looking for, naming the two bank officials who were killed as Kurdyumov, the State Bank’s cashier, and Golovnya, an accountant. The following excerpt gives a few more details:
The bodies of three Cossacks, the bank officials and some innocent
passers-by lay in pieces. The censored newspapers kept casualties low
but the Okhrana’s archives reveal that around forty were killed. Dressing-stations for the wounded were set up
in nearby shops. Twenty-four seriously wounded were taken to hospital.
An hour later, passers-by saw the funereal progress of a ghoulish
carriage carrying the dead and their body-parts down Golovinsky...
"A fragment of the 1913 map of Tiflis, highlighting Erivansky [Yerevansky] Square and adjacent streets." Source: Wikipedia
The grenades or bombs (at least 8 according to Stephen Kotkin) were thrown under both carriages. The attackers also had guns. The lead carriage carried the two bank officials and two or three guards. The following phaeton (an open carriage) had more soldiers; none of the academic sources give a specific number, but a fictionalized account in the 1958 historical novel Suicide (or 'Suicides') by Mark Aldanov gives five soldiers. For a phaeton this number seems reasonable, and Aldanov clearly researched the robbery (here is an English translation of the robbery section of the novel). Then there were five mounted Cossacks ("two in front, two behind and another alongside the two carriages" according to Montefiore). Including (presumably) two coach drivers, this gives a total of around 16 non-passersby (of whom only one is known to have survived).
The phaetons would have offered little protection against the grenades, and the attackers also had guns. They would presumably have targeted any of the armed guards still alive after the explosions. We know that one of the coach drivers survived (he was later caught trying to pocket some the money the robbers dropped), but it seems likely that few, if any, of the others did, so there may have been as many as 15 deaths in total in the two carriages.
The number of police around the square / at corners of the side streets, and how many of them were killed by Bolshevik gunmen, is unknown. The high number of fatalities among passersby was almost certainly due to the powerful grenades used. The explosions broke doors and window panes over a large area and even toppled some chimneys; many would have been killed by shrapnel. It is also more than possible that some of the grenades were not thrown very accurately; the attackers were not known for worrying about collateral damage. Mikl¢s Kun states that the
robbers threw eight, or according to certain sources ten, bombs into
the square in all directions.
If Kun's account is correct, this would certainly explain the high number of casualties among passersby in a crowded square.
The New York Times article of June 27, 1907 (image in the 1907 Tiflis bank robbery Wikipedia article mentions only that "two employees of the bank were killed". Scanning of other books on Stalin failed to turn up any accounts with the amount of detail given by Montefiori and Mikl¢s Kun. Even Stephen Kotkin's massive Stalin, Vol. I: Paradoxes of Power, 1878-1928 (976 pages) makes no mention of the bank officials or anyone else killed.
All emphasis is mine.