We apply the MC@NLO formalism to the production of heavy-quark pairs in pointlike photon-hadron collisions. By combining this result with its analogue relevant to hadron-hadron collisions, we obtain NLO predictions matched to parton showers for the photoproduction of Q (Q) over bar pairs. We compare MC@NLO results to the measurements of c- and b-flavoured hadron observables performed by the H1 and ZEUS Collaborations at HERA. (C) 2011 Elsevier B.V. All rights reserved.